Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Webdatepicker date changed after the postback
posted

Hi,

I have created dynamic web date picker in my application.  i select the date (05/26/2017 12:00:00 AM )  , after the post back it get changed as ( 05/25/2017 06:30:00 PM).

Note : if i set the machine time zone Central time (US & CANADA) means it's working fine, after the post back date not changed in web date picker.

If I set other time zone means issue will come,

Review my code and kindly give the solution for this issue.

wdcDateColumn = new WebDatePicker();
wdcDateColumn.Width = Unit.Pixel(115);
wdcDateColumn.ID = columnName;
wdcDateColumn.BackColor = Color.White;
System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
ci.DateTimeFormat.LongDatePattern = datePreference;
ci.DateTimeFormat.ShortDatePattern = datePreference;
wdcDateColumn.Culture = ci;
wdcDateColumn.Nullable = true;
wdcDateColumn.ClientSideEvents.ValueChanged = "AssignModifiedDate";
container.Controls.Add(wdcDateColumn);
wdcDateColumn.NullText = String.Empty;