Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Date and time strings to TDataSet columns
Mon, Sep 14 2020 8:08 AMPermanent Link

Paul Coshott

Avatar

Hi All,

I have some JSON being received that includes a date and a time in the following format:

Date : '2020-09-14'
Time : '16:45:00'

How do I convert these to assign the value to a dataset column (of DataType dtDate and dtTime).

Thanks for any help,
Paul
Tue, Sep 15 2020 4:36 AMPermanent Link

Walter Matte

Tactical Business Corporation

Paul

Tim's framework (EWB) specifies that Date, Time, and DateTime needs to be a single integer in Unix time number of milliseconds.... see JSON reference in manual.

So if you are getting data and time in another format as you indicate, you will need to load into a field that is a string and do your own convertion into another field OnLoad.

As least that is what  I would do.

Date : '2020-09-14'
Time : '16:45:00'

Parse the fields and use EncodeDate and EncodeTime....

Walter
Wed, Sep 16 2020 2:49 AMPermanent Link

Paul Coshott

Avatar

Thanks Walter. I used what you suggested and got it working with a little help from Tim.

Cheers,
Paul


Walter Matte wrote:

Paul

Tim's framework (EWB) specifies that Date, Time, and DateTime needs to be a single integer in Unix time number of milliseconds.... see JSON reference in manual.

So if you are getting data and time in another format as you indicate, you will need to load into a field that is a string and do your own convertion into another field OnLoad.

As least that is what  I would do.

Date : '2020-09-14'
Time : '16:45:00'

Parse the fields and use EncodeDate and EncodeTime....

Walter
Image