I’ve got a table in SQL Server 2005 that has a datetime column holding dates in UTC form. I want clients to call the a .NET server app and the server will return a DataTable with records to be bound client side to a DataGridView. ** On the client the dates should be displayed in local time **, clients will be in may regions of the world. Does anyone have any tips on achieving this? I could of course add a few lines to loop through and update the dates in the table before display but I can’t help feeling there’s got to be some snazzy funky way of doing this.
TA!!
DateTime.ToLocalTime Is what you’re looking for.
Essentially, the fact that you’re calling the method tells the DateTime object to add the current culture’s offset from UTC and return the result. DateTime.ToUniversalTime does the opposite.