Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Dataset and json date format
Wed, Oct 3 2012 5:33 PMPermanent Link

Sergei Safar

Hi all,

my web server is sending dates in the following json format: YYYY-MM-DD (PHP, MySQL, jsonencode function)

In EWB, Editing Dataset, tab Preview, the format is DD/MM/YYYY. Is there a way to change dataset date format?

Regards
Sergei Safar
Thu, Oct 4 2012 7:28 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Sergei,

Internally a Date/Time is not formatted, it's just an integer representing
the number of milliseconds since the 1st of January, 1970.
Display and editing formats are controlled by an automatically created
object called FormatSetting.
Take a look here :
http://www.elevatesoft.com/manual?action=viewcomp&id=ewb1&comp=TFormatSettings
..

--
Fernando Dias
[Team Elevate]
Thu, Oct 4 2012 9:18 AMPermanent Link

Sergei Safar

Fernando,

thank you for your reply. Now I am trying to modify the way my webserver returns DATEs.

My question is: in which format datasets in EWB expects the field date?
For example, I tried the following formats (json):

{ "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"2012-10-04" . . .

{ "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"2012/10/04" . . .

{ "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"04-10-2012" . . .

{ "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"04/10/2012" . . .


and the dataset, field DATE COLLECT, always shows (TGrid) the same strange date: 12/31/1969

Other fields of the same dataset (string, integer, boolean) are all ok.

Regards,
Sergei Safar

"Fernando Dias" wrote:

Sergei,

Internally a Date/Time is not formatted, it's just an integer representing
the number of milliseconds since the 1st of January, 1970.
Display and editing formats are controlled by an automatically created
object called FormatSetting.
Take a look here :
http://www.elevatesoft.com/manual?action=viewcomp&id=ewb1&comp=TFormatSettings
..

--
Fernando Dias
[Team Elevate]
Thu, Oct 4 2012 9:35 AMPermanent Link

Raul

Team Elevate Team Elevate

Sergei,

as per spec

http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=JSON_Reference

Date,TimeDate/Time   

Specify any valid integer value (positive or negative) for non-null
values. If not null, the incoming value represents the number of
milliseconds since midnight on January 1, 1970, and can be negative for
time values


Raul


On 10/4/2012 9:18 AM, Sergei Safar wrote:
> Fernando,
>
> thank you for your reply. Now I am trying to modify the way my webserver returns DATEs.
>
> My question is: in which format datasets in EWB expects the field date?
> For example, I tried the following formats (json):
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"2012-10-04" . . .
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"2012/10/04" . . .
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"04-10-2012" . . .
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"04/10/2012" . . .
>
>
> and the dataset, field DATE COLLECT, always shows (TGrid) the same strange date: 12/31/1969
>
> Other fields of the same dataset (string, integer, boolean) are all ok.
>
> Regards,
> Sergei Safar
>
Thu, Oct 4 2012 1:34 PMPermanent Link

Sergei Safar

Hi,

now I got it. Everything is ok.

If someone uses MySQL/PHP as back-end the hint is:

Change:
SELECT `SomeDateField` FROM SomeTable

To:
SELECT UNIX_TIMESTAMP(`SomeDateField`) * 1000 AS 'SomeDateField' FROM SomeTable

Thank you all.

Regards
Sergei Safar

Raul wrote:

Sergei,

as per spec

http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=JSON_Reference

Date,TimeDate/Time   

Specify any valid integer value (positive or negative) for non-null
values. If not null, the incoming value represents the number of
milliseconds since midnight on January 1, 1970, and can be negative for
time values


Raul


On 10/4/2012 9:18 AM, Sergei Safar wrote:
> Fernando,
>
> thank you for your reply. Now I am trying to modify the way my webserver returns DATEs.
>
> My question is: in which format datasets in EWB expects the field date?
> For example, I tried the following formats (json):
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"2012-10-04" . . .
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"2012/10/04" . . .
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"04-10-2012" . . .
>
> { "rows": [{"Cod City":"BHZ","Cod TV":"02","Date Collect":"04/10/2012" . . .
>
>
> and the dataset, field DATE COLLECT, always shows (TGrid) the same strange date: 12/31/1969
>
> Other fields of the same dataset (string, integer, boolean) are all ok.
>
> Regards,
> Sergei Safar
>
Tue, Oct 9 2012 3:58 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Sergei,

<< If someone uses MySQL/PHP as back-end the hint is: >>

Nice tip, thanks very much. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Image