Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
7 Odpowiedzi
10639 Widoki

Hello;

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

Thanks a lot in advance

Awatar
Odrzuć
Najlepsza odpowiedź

what about literal comparison

a < b

or

a > b

or 

a == b

?

Awatar
Odrzuć

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.

Najlepsza odpowiedź

You can use normal python datetime code to compare it.


Thanks.

Awatar
Odrzuć
Autor

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

Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

Thanks a lot for the link

Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
mar 25
1268
0
sty 25
3324
1
sie 23
14627
change password Rozwiązane
1
sie 23
13266
1
lip 23
10287