Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
7 Ответы
10658 Представления

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
1278
0
янв. 25
3348
1
авг. 23
14642
change password Решено
1
авг. 23
13289
1
июл. 23
10298