コンテンツへスキップ
メニュー
この質問にフラグが付けられました
7 返信
10644 ビュー

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
1268
0
1月 25
3327
1
8月 23
14629
1
8月 23
13274
1
7月 23
10288