Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
7 ตอบกลับ
10677 มุมมอง

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
1282
0
ม.ค. 25
3368
1
ส.ค. 23
14668
change password แก้ไขแล้ว
1
ส.ค. 23
13305
1
ก.ค. 23
10312