跳至內容
選單
此問題已被標幟
7 回覆
10654 瀏覽次數

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
3月 25
1275
0
1月 25
3342
1
8月 23
14639
1
8月 23
13283
1
7月 23
10295