#1 2021-04-10 15:48:06

ertank
Member
Registered: 2016-03-16
Posts: 163

Json with datetime as unix timestamp

Hello,

I tried to search in the forum without any success.

I receive a JSON string as following:

"lastPriceChangeDate": 1616569735683,
"lastStockChangeDate": 1618009761506,
"lastUpdateDate": 1618009761506,

This is a Unix Timestamp in milliseconds format.

Can I directly de-serialize that kind of values into to a TDateTime variable using mORMot?

Thanks & Regards,
Ertan

Last edited by ertank (2021-04-10 15:48:27)

Offline

#2 2021-04-10 18:49:06

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

Re: Json with datetime as unix timestamp

A JavaScript client won't be able to unserialize it.
But mORMot could unserialize it - but not as TDateTime, but as TUnixMsTime.
Then you will have to use the mORMot conversion function into TDateTime.

Offline

Board footer

Powered by FluxBB