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. Image for the cookie policy date

Time Zone issue

I have an issue with the datetimepicker control is sending the datetime in UTC format to the SQL Server. This is how it is stored on the backend. But when it comes back from the SQL side how do I convert it back to CST time zone? 

Can you help?



1 Reply

SI Silambarasan I Syncfusion Team February 23, 2019 04:53 AM UTC

Hi Ameet, 
Thank you for contacting Syncfusion support. 
We have checked with your requirement and prepared the sample for converting the provided date value in UTC time zone to CST timezone. Here, the initial value set to the DateTimePicker component is converted to UTC value and this UTC value is converted into CST time zone value by using CST time zone offset(-6) value as shown below. 
export class DefaultDateTimePickerComponent { 


public datetimeObj: DateTimePickerComponent;

onCreate(args) {
let a = new Date("1/1/2019 10:00 PM"); // get UTC time in msec  
let utc = a.getTime() + (a.getTimezoneOffset() * 60000); // using CST offset and assign the value to the DateTimePicker // -6 is offset of CST time zone  
this.datetimeObj.value = new Date(utc + (3600000 * -6));  

Sample Link:  
If we misunderstood your query or still facing issues, please revert us along with below details so that we can provide the exact solution at the earliest. 
1. Issue reproducing sample or code snippets
2. How date value is passed to the server?
3. Which back-end being used in your application (Web API in C# or any other angular method)?
4. How values get stored in the database?
5. Which type of value did been returned from the server? 

Live Chat Icon For mobile
Up arrow icon