3

I am doing work on a new logging database that I have decided to use UTC datetime to store all datetime values since our company spans timezones and multiple sources and timezones are logging events. That is working great.

However the problem that I cannot get my head around is formatting the datetimes in my datagridview for my user application.

Our applications use mostly LINQ to SQL to manipulate our data from generic SQL CRUD calls, so I am hoping I can mask/format the DGV to get the conversion or some LINQ function rather than having to write special SQL stored procedures to do it every time I need to display the data.. (I have found multiple sources that explain how to do that)

Thank you in advance. Tried to give as much information as I can think of, but if I am missing something, please let me know.

Would love the answer in VB.NET, but C# works great as well (versed fully in both, this app just happens to be in VB.BET)

RiddlerDev
  • 7,370
  • 5
  • 46
  • 62

1 Answers1

3

In your RowCreatedEvent, you should be able to use the function: TimeZoneInfo.ConvertTimeFromUtc

See the Microsoft documentation for some good examples (in both Vb & C#):

http://msdn.microsoft.com/en-us/library/system.timezoneinfo.converttimefromutc.aspx

PaulStock
  • 11,053
  • 9
  • 49
  • 52
  • Thank you, I did not even think of the dgv events... I was already doing that for one of the dgv columns to do images. Thank you for correcting my brain :) – RiddlerDev Sep 01 '11 at 03:33