DataGridView, ProBindingSource and DATETIME-TZ

Posted by bsgruenba on 24-May-2010 11:53

I ran into a weird one this weekend and I want to check that this is not a known issue. I created a UI that derived data for a DataGridView from a temp-table. The temp-table has two fields that are (necessarily) DATETIME-TZ.

I'm on the West Coast of the US - Pacific Time - 7 hours behind UTC. Although the data in the temp-table was correct, when I displayed the data in the DataGridView, it was displayed 7 hours behind my time. In other words, something that should be at 3:00pm was displaying as 8:00am.

I thought that I may have to set a locale or something for .NET to know this. So I looked at the System.TimeZone class and found out that it is set to Pacific time. The it occurred to me that the DGV should not be worrying about that anyway - it is just a UI control, so the issue has to be with the ProBindingSource.

So the question is what am I supposed to have set (if anything) for the PBS to do the right timezone thing?

FWIW, I ended up changing the data type in the temp-table to DATETIME and setting the DATETIME to local time from the DATETIME-TZ that I had retrieved.

All Replies

This thread is closed