Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
7 Відповіді
10649 Переглядів

Hello;

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

Thanks a lot in advance

Аватар
Відмінити
Найкраща відповідь

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.

Найкраща відповідь

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

Найкраща відповідь

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

Аватар
Відмінити
Автор

Thanks a lot for the link

Найкраща відповідь

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
бер. 25
1269
0
січ. 25
3334
1
серп. 23
14629
change password Вирішено
1
серп. 23
13276
1
лип. 23
10290