#1 2017-03-05 13:06:04

mingda
Member
Registered: 2013-01-04
Posts: 121

about javascript DateTime type

For javascript datetime just integer value for milliseconds since midnight on January 1, 1970, when transmit json, encode just like integer, so i define it like this:


  TTimeStamp = type Int64;


  TSQLBase = class(TSQLRecord)
  private
    fEta: TTimeStamp;
  published
    property Eta: TTimeStamp read fEta write fEta;


this is all ok until now, now i need to generate report, i use
JSONToDataSet in unit mORMotVCL to convert json to TSynSQLTableDataSet,
but the datetime all display it's integer value, is there any method
let the javascript datetime to display ok, any suggest is welcome, thanks!

Mingda

Offline

#2 2017-03-05 19:27:43

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

Re: about javascript DateTime type

Use TUnixTime or TUnixMSTime types.

Offline

#3 2017-03-06 00:43:03

mingda
Member
Registered: 2013-01-04
Posts: 121

Re: about javascript DateTime type

ab wrote:

Use TUnixTime or TUnixMSTime types.

Just test, JSONToDataSet in mORMotVCL not deal with TUnixMSTime type, still show it's int64 value, -:(

Offline

#4 2017-03-06 09:58:42

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

Re: about javascript DateTime type

Offline

#5 2017-03-06 13:46:21

mingda
Member
Registered: 2013-01-04
Posts: 121

Re: about javascript DateTime type

strange, after update, the fastreport connect to the dynamic create dateset, (TSynSQLTableDataSet create by JSONToDataSet in mORMotVCL) still display integer value. (By the way, you are a super man. smile)

update:

Perhaps i use raw sql to get the result, and column name use alias, in the json result, there is no column type info, like below

    DataSetSql := 'select columnA aliasA, columnB aliasB from table';
    Json := Client.ExecuteJson([], DataSetSql);
    if Json = '' then Continue;
    ReportDataSetDynArray[I].Dataset := JSONTODataSet(nil, Json);

Last edited by mingda (2017-03-06 14:01:09)

Offline

Board footer

Powered by FluxBB