Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How two compare two fields datetime??

By
Drees Far
on 7/13/15, 4:52 AM 766 views

Hello;

Please, who knows how to compare to fields datetime in odoo v8.

Thanks a lot in advance

0

Temur

--Temur--
2894
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 7/13/15, 6:58 AM

what about literal comparison

a < b

or

a > b

or 

a == b

?

default date and datetime formats in odoo allow you to compare literally datetime or date strings and result of such comparison will correspond to the comparison of corresponding dates.

Temur
on 7/13/15, 7:02 AM
0

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 7/26/15, 6:51 AM

Dear Drees Far,

I think this example may be use full

>>> from datetime import datetime

>>> past = datetime.now()

>>> present = datetime.now()

>>> past < present

True

>>> datetime(2012, 1, 1) > present

False

>>> present - datetime(2000, 4, 4)

datetime.timedelta(4242, 75703, 762105)

Regards,

Ankit H Gandhi

0
ahmad
On 7/13/15, 5:05 AM

You can use normal python datetime code to compare it.


Thanks.

Please, what do you mean by use normal python datetime code. Can you give me an example please

Drees Far
on 7/13/15, 5:56 AM
0
Dairidi
On 7/13/15, 5:25 AM

Follow this Link https://docs.python.org/2/library/datetime.html and read the python datetime doc

Thanks a lot for the link

Drees Far
on 7/13/15, 5:55 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/13/15, 4:52 AM
Seen: 766 times
Last updated: 7/28/15, 9:45 AM