This is a migrated thread and some comments may be shown as answers.

UTC DateTimes as local DateTimes, and vice versa

3 Answers 552 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 20 Apr 2020, 04:42 PM

Hi, I have a question regarding the handling of UTC DateTime values in the Grid and DateTime Picker components.

In our C# code and database, all date and time data is in UTC. Is it currently possible to:

  • Have UTC DateTime values displayed in the Telerik Grid according to the the user's local culture?
  • Have values selected by the user via DateTime Picker be converted to UTC?

Two examples:

  • A Grid column binded to a UTC DateTime value 2020/20/04 15:00 will display as 20/04/2020 16:00 for users in the UK
  • If 16:00 is selected in the DateTime Picker by a UK user during daylight saving time, 15:00 is the time that is actually stored

Thanks in advance!

3 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 23 Apr 2020, 09:50 AM

Hello Michael,

Such conversions are up to the application and the view-model. Our components display what the app provides to them. For example, using a DateTime.Now in a WebAssembly app will have different results than using it in a server-side Blazor app. This is not something we can control or should control. We use the default .Kind of the DateTime object and we don't alter it additionally, so that we don't break the application that already takes care of that.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Michael
Top achievements
Rank 1
answered on 24 Apr 2020, 01:07 PM

Hi Marin,

Apologies, I was shortsighted with this query. After posting it I did some thinking and realised that, as you said, these concerns were more up to the application itself, and implemented code to do the conversions between the timezones as the data was being sent and received to/from the DB.

Kind regards,

Michael

0
Marin Bratanov
Telerik team
answered on 24 Apr 2020, 01:50 PM

Hi Michael,

It is a perfectly valid question, and I am glad this information is now available in the public forums, so everyone can find it. Thank you for bringing it up.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Michael
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Michael
Top achievements
Rank 1
Share this question
or