[Data Grid Web] Format DateTime
data-grid
Forge component by Platform Maintenace
Application Type
Traditional Web

Hello,

I have a problem when get Date Time Data.

If i saved date time data from Data Grid, it is OK.

But I saved date time data from Input Widgets, and display on Data Grid, it is +9 hours.

Why +9 hours ? What wrong in this function in Data Grid Framework ?

Hello Huyen IT ,

Could you please give us an example so that we can examine and try to give you the best option according to your needs?
 

Thank you,

Gabriel Lundgren

Hi Gabriel Lundgren,

Thanks you for support,

I have Check In Data, input from RichWidgets:

And saved into Database

But when show it on Data Grid, +9 Hours, why ?

I don't understand why it is +9 hours ?

mvp_badge
MVP

Hi Huyen IT,


For formatting the date, you can use the field DateFormat on your Input_Calendar widget:


For instance, if you want to just display the date in format DD-MM-YY, you should define it as %d-%m-%y


Regarding the difference in dates you see between the screen and the database, it has to do with the Javascript.

Both dates are the same, the difference is that the one you see in the database is stored on GMT + 1, but then the Javascript "gets" the timezone of your desktop / mobile device and automatically converts it to your timezone GMT + 9, hence the difference.

If you really want to force it to display the same date in GMT + 1 as you have in the database, you can use the Timezone forge component which provides you server-side actions to convert timezones for Traditional Web.


Hope it helps.


Cheers,
João

Thanks João for test for me.

>>Both dates are the same, the difference is that the one you see in the database is stored on GMT + 1, but then the Javascript "gets" the timezone of your desktop / mobile device and automatically converts it to your timezone GMT + 9, hence the difference. 

Exactly my error, however if i save (put) data from Data Grid (Grid Column date time) and show it, it is OK.
It is +9 hours when save (put) data from Widgets_InputCalendar.
I think it seems to be related to millisecond.

Because personal environment is limited to 2GB, I will restrict adding unnecessary components: D

I will try with "millisecond"

Thanks.

Hi, Huyen IT.


Are you sure that input uses DateTime? There is possible that uses Date type?

Hi Felipe, 

I have Check In Data, input from RichWidgets:

And saved into Database

And show it on Data Grid, +9 Hours

+9 Hours when format JSON data date time:

We are aware that there are some inconsistencies regarding dates and times. The DataGrid team is currently taking this issue into consideration and we are expecting to have a fix on one of the next releases.


Thanks Gabriel Lundgren for supported  :)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.