TimeZones on DataGrid in EJ2

I've got a simple datagrid with a popup editor in EJ2.

I store the local timezone in a record in the database, not the user record, but the account record as one user can have multiple accounts.

I use the IOptions extension to specify global options for the account that is selected after logging in.  This is stored in a IOptions<Global> class.

Adding the record, I set the defaultvalue to local time.  @TimeZoneInfo.ConvertTime(DateTime.Now,global.Value.TimeZoneInfo)



When the add button is clicked, the time displays correctly.


When it's submitted to the database, it's submitted as UTC.  This is OK.

However, I need to convert the value from UTC to local time to display it in the grid.  Which it is NOT doing.



How can I display the value as local time on this grid?

Thanks




1 Reply

RR Rajapandi Ravi Syncfusion Team April 20, 2020 01:04 PM UTC

Hi Sean, 

Thanks for contacting Syncfusion forum. 

By default if we set UTC datetime value in dataSource, its automatically converted to the local time zone (local machine time Zone) value. It default behavior.  

In your reported information you have used @TimeZoneInfo.ConvertTime(DateTime.Now,global.Value.TimeZoneInfo) to convert local time while adding new record in grid, but it’s not needed because of our default behavior. 

If we misunderstood your problem or still facing the issue please share below details. 

  1. Share  your dataSource structure.
  2. Share your runnable sample.

Please get back to us, if you need any further assistance. 

Regards, 
Thiyagu S. 


Loader.
Up arrow icon