We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Convert UTC datetime to localtime

Thread ID:

Created:

Updated:

Platform:

Replies:

145010 Jun 1,2019 08:03 AM UTC Jun 3,2019 07:25 AM UTC Dashboard Platform 1
loading
Tags: Dashboard Designer
Malcolm van Staden
Asked On June 1, 2019 08:03 AM UTC

Hi,

We have a dataset that contains UTC dates which we'd like to display as local dates (server local time). Is there a way to do this with the dashboard designer using an expression column?

-Malcolm

Renuka N [Syncfusion]
Replied On June 3, 2019 07:25 AM UTC

Hi Malcolm, 
 
Thanks for contacting Synfusion support.
 
Using Expression column, we can’t able to convert UTC time to local time in Dashboard Designer. You can achieve your requirement using code view option if you are using server types connection like SQL, MySQL and Postgres. 
 
For SQL server you can use DATEADD() function to add the hours or minutes in your date.  
Example:  If your local time is 2h ahead of Universal Coordinated Time, then you can add below line in your code view to achieve your requirement, 
DATEADD(hour, 2, [date time column]) as [LocalTime] 
 
If your local time is 5h 30m ahead of Universal Coordinated Time, then you can add below line in your code view to get the local time, 
DATEADD(mi, 330, [date time column]) as [LocalTime] 
Note: Here we have converted the 5 h 30 m to minutes (330) and then add the value with your date time column.  
 
Please refer below screen shot for your reference, 
  
 
For MySQL server, you can use DateAdd() function like as below,’ 
DATE_ADD([date column], INTERVAL 2 HOUR) as “LocalTime” 
 
For Postgres server, you can use DateADD() function like as below, 
[date column] + INTERVAL ‘2 hour’ as “LocalTime” 
 
Kindly refer below documentation link to know more about code view support in Dashboard Designer, https://help.syncfusion.com/dashboard-platform/dashboard-designer/connecting-to-data/connecting-through-custom-sql-query 
 
Please let us know if you need any further assistance.
 
Regards,
Renuka N.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon