Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
7 Besvarelser
10661 Visninger

Hello;

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

Thanks a lot in advance

Avatar
Kassér
Bedste svar

what about literal comparison

a < b

or

a > b

or 

a == b

?

Avatar
Kassér

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.

Bedste svar

You can use normal python datetime code to compare it.


Thanks.

Avatar
Kassér
Forfatter

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

Bedste svar

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

Avatar
Kassér
Forfatter

Thanks a lot for the link

Bedste svar

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

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
mar. 25
1278
0
jan. 25
3355
1
aug. 23
14644
1
aug. 23
13291
1
jul. 23
10301