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
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;
}
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.
Please login first to submit.