Skip to Content
Menu
This question has been flagged
7 Replies
10669 Rodiniai

Hello;

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

Thanks a lot in advance

Portretas
Atmesti
Best Answer

what about literal comparison

a < b

or

a > b

or 

a == b

?

Portretas
Atmesti

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.

Best Answer

You can use normal python datetime code to compare it.


Thanks.

Portretas
Atmesti
Autorius

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

Best Answer

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

Portretas
Atmesti
Autorius

Thanks a lot for the link

Best Answer

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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
kov. 25
1280
0
saus. 25
3361
1
rugp. 23
14655
1
rugp. 23
13300
1
liep. 23
10303