DateTimePicker timezones

0
0

I was wondering if you guys had a datetime picker that doesn’t do any timezone conversion to UTC?

We have a UI where a customer can select a date and time and then timezone for that datetime and we’ve been fighting Wisej’s datetimepicker because it is converting it to UTC.

Thanks,
Mark

  • You must to post comments
0
0

You need to set the timezone on the DateTimePicker?

Dates are always managed using UTC since the server and the client may very well be in different time zones. When the date arrives at the server, it is converted to local time using the timezone of the client for that specific session/thread. For example, a user in NY using a server in California would always have the dates using the NY timezone.

  • Mark Reed
    I totally get that which is why I am having issues. Because the server is in UTC. The browser might be in Kiev and he might be setting the time to 8:00pm PST
  • Luca (ITG)
    What type of issues? UTC is the same as GMT or +0, the client in Kiev should always see and have the date values in Kiev time. Otherwise it’s a bug in Wisej.
  • You must to post comments
0
0

I think I got it working I added a new function to the customdatetimepicker like this.

public void SetValue(DateTime startTime, TimeZoneInfo originalTimeZone)
{
var diff = (originalTimeZone.BaseUtcOffset.TotalMinutes – Application.Browser.TimezoneOffset) – originalTimeZone.BaseUtcOffset.TotalMinutes;
startTime = startTime.AddMinutes(diff * -1);
startTime = DateTime.SpecifyKind(startTime, DateTimeKind.Utc);
this.Value = startTime;
}

  • Mark Reed
    The regardless of the browser’s timezone it always show the same time in the datetimepicker textbox
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.