Local Time

Good afternoon!

I'm facing a problem about DateTime. My API generates the atual DateTime in the server and stores it in UTC format. But I need retrieve that data in the local DateTime to show to the user. I saw some rotines in javascript but till now it didn't work.
Would you have some advice?

Thanks in advance!

5 Replies

BC Berly Christopher Syncfusion Team April 1, 2021 02:27 PM UTC

Hi Társis, 
  
Greetings from Syncfusion support. 
  
We can convert the UTC DateTime values into the LocalTime Values with help of ToLocalTime() method in the C#. Kindly refer the below stack overflow links. 
  
  
  
Regards, 
Berly B.C 



Társis April 1, 2021 02:52 PM UTC

Thank you for your answer,

but if I call ToLocalTime() it will still give me the local time of the server and not of the client.
In my case, my customers are from Brazil, but my API runs in EUA. I need to know the date converted to local time in my customers in Brazil.

Thanks in advance!


JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team April 2, 2021 06:53 AM UTC

Hello Társis, 
 
Thanks for your elaboration. 
 
We checked your reported issue. We would like to know you that it is not possible in the server side to get the client’s timezone unless client notifies to the server about its timezone. Please refer the below stackoverflow answer.

StackOverflow Link 1      : https://stackoverflow.com/a/8194041/9133493
 
 
However, we can achieve the reported requirement by notifying the server about client’s timezone by sending a http request. Please refer the below answer to get client timezone from server.

StackOverflow Link 2      : https://stackoverflow.com/a/30503614/9133493
 
 
Regards, 
Jeyanth. 



Társis April 2, 2021 06:43 PM UTC

Thank you very much, it worked!


BC Berly Christopher Syncfusion Team April 5, 2021 05:32 AM UTC

Hi Társis, 
  
Most welcome. Please let us know if you need further assistance on this. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon