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

Time Zone issue

Thread ID:

Created:

Updated:

Platform:

Replies:

142847 Feb 21,2019 11:29 PM UTC Feb 23,2019 04:53 AM UTC Angular - EJ 2 1
loading
Tags: Calendar
Ameet
Asked On February 21, 2019 11:29 PM UTC

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?

Thanks,

Ameet

Silambarasan I [Syncfusion]
Replied On 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 { 

@ViewChild('datetime')
 

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? 
 
Regards, 
Silambarasan 


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