Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
7 Trả lời
10640 Lượt xem

Hello;

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

Thanks a lot in advance

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

what about literal comparison

a < b

or

a > b

or 

a == b

?

Ảnh đại diện
Huỷ 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.

Câu trả lời hay nhất

You can use normal python datetime code to compare it.


Thanks.

Ảnh đại diện
Huỷ bỏ
Tác giả

Please, what do you mean by use normal python datetime code. Can you give me an example please

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks a lot for the link

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 25
1268
0
thg 1 25
3326
1
thg 8 23
14627
change password Đã xử lý
1
thg 8 23
13266
1
thg 7 23
10287