troubleshooting Question

Working with DateTime independent of Timezone

Avatar of schwarz2
schwarz2 asked on
Programming.NET ProgrammingVisual Basic.NET
6 Comments1 Solution1803 ViewsLast Modified:
Hello,

I am working with a VB.NET 2005 application in which I need to store date and time information.  I'm using a datagridview which is backed by a datatable (unbound to a database).  At the end of every session, I write this datatable to an XML file, and in new sessions I attempt to reload the datatable from the stored XML (ReadXML/WriteXML methods).

My goal is to make the application independent of timezones.  If I'm in GMT-5 and store datetime info, I want to be able to write this to the XML file, then change my computer to GMT-8, reload the datatable, and see that datetime exactly as originally input.  5:00pm is 5:00pm whether in Eastern Time or Pacific Time.

Of course, the answer typically suggested is to use Universal Time.  That's okay, but I need help in making the application stay in the Universal Time mentality.  I need the datagridview to not do any conversions to local time and to properly write to the XML with the +00:00 extension.

Any ideas?
(By the way, if you can answer this question, you can probably answer this person's question which is about to be deleted, I think:  https://www.experts-exchange.com/Programming/Languages/.NET/Class_Libraries/ADO.NET/Q_23307356.html ).

Many many thanks.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros