Last post Feb 22, 2010 10:07 PM by raghav_khunger
Feb 22, 2010 08:17 AM|richhollis|LINK
I have dates stored in UTC in my SQL database. I want to render local date/times for date/time columns.
Bind seems messy. I have thought about perhaps creating a derived data field (e.g. derived BoundField) that performs the ToLocalTime conversion during the data bind.
I'm really looking for advice/suggestion on the available options and potentially the cleanest and reusable way to implement this.
gridview utc localtime
Feb 22, 2010 09:23 AM|hans_v|LINK
Feb 22, 2010 10:43 AM|mvark|LINK
show the the UTC date-time as local date-time on the client-side.
For sample code, check this -
Feb 22, 2010 10:07 PM|raghav_khunger|LINK
In 3.5 TimeZoneInfo was added use it:
TimeZoneInfo.ConvertTime(DateTime.SpecifyKind(yourdateimefromoutside, DateTimeKind.Unspecified), TimeZoneInfo.Local)