Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
7 Răspunsuri
10643 Vizualizări

Hello;

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

Thanks a lot in advance

Imagine profil
Abandonează
Cel mai bun răspuns

what about literal comparison

a < b

or

a > b

or 

a == b

?

Imagine profil
Abandonează

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.

Cel mai bun răspuns

You can use normal python datetime code to compare it.


Thanks.

Imagine profil
Abandonează
Autor

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

Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor

Thanks a lot for the link

Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
mar. 25
1268
0
ian. 25
3327
1
aug. 23
14629
1
aug. 23
13274
1
iul. 23
10288