Se rendre au contenu
Menu
Cette question a été signalée
7 Réponses
10636 Vues

Hello;

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

Thanks a lot in advance

Avatar
Ignorer
Meilleure réponse

what about literal comparison

a < b

or

a > b

or 

a == b

?

Avatar
Ignorer

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.

Meilleure réponse

You can use normal python datetime code to compare it.


Thanks.

Avatar
Ignorer
Auteur

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

Meilleure réponse

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

Avatar
Ignorer
Auteur

Thanks a lot for the link

Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
0
mars 25
1266
0
janv. 25
3312
1
août 23
14626
1
août 23
13263
1
juil. 23
10285