Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
7 Respostas
10642 Visualizações

Hello;

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

Thanks a lot in advance

Avatar
Cancelar
Melhor resposta

what about literal comparison

a < b

or

a > b

or 

a == b

?

Avatar
Cancelar

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.

Melhor resposta

You can use normal python datetime code to compare it.


Thanks.

Avatar
Cancelar
Autor

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

Melhor resposta

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

Avatar
Cancelar
Autor

Thanks a lot for the link

Melhor resposta

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

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
mar. 25
1268
0
jan. 25
3327
1
ago. 23
14629
1
ago. 23
13274
1
jul. 23
10288