#1 2024-02-19 20:59:15

tech
Member
Registered: 2014-01-13
Posts: 107

mormot2 handle TDateTime as float

Hi,

mormot1 was handling Tdate/TDateTime as text in database and we can filter on with some funtions like here https://synopse.info/forum/viewtopic.php?id=4909
but  in mormot2 it's handled as float and some of these functions aren't available.
How we can filter on a Tdate/TDateTime field on mormot2 ?


Regards,

Offline

#2 2024-02-20 07:44:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,244
Website

Re: mormot2 handle TDateTime as float

I don't think so.
If you define TOrm fields as TDateTime and TDateTimeMS, they will be handled as ISO-8601 text in the database with mORMot 2 (via oftDateTime / oftDataTimeMS field types).
See GetOrmFieldType() in mORMot 2 and TTypeInfo.GetSQLFieldType() in mORMot 1.

The TOrmTest class in test.core.data.pas regression tests validate this behavior. It has a TOrmTest.ValDate: TDateTime field, which is handled as ISO-8601 text in the DB.

Perhaps you use plain TDate, which is supported as float in both mORmot 1 or mORMOt 2.

Offline

#3 2024-02-20 10:20:57

tech
Member
Registered: 2014-01-13
Posts: 107

Re: mormot2 handle TDateTime as float

Hello,

You're right AB I used plain TDate which is supported as float. Now I change it to TDateTime and it works.

Thnx,

Offline

Board footer

Powered by FluxBB