I want to add the current date/time to an XML document
So i use something like this
XmlAttribute receivedDateTime = SettingsFile.CreateAttribute("ReceivedDateTime");
receivedDateTime.Value = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
Debug.WriteLine("Adding Date Time in addMessage method : " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
Debug.WriteLine("Short Time Only: " + DateTime.Now.ToShortTimeString());
Debug.WriteLine("Long Time Only: " + DateTime.Now.ToLongTimeString());
Debug.WriteLine("Local Time: " + DateTime.Now.ToLocalTime());
But it automatically adds 1 hour to the actual time!
So if the actual time is 10.15 AM,
the debug messages print
Adding Date Time in addMessage method : 8/3/10 11:15 AM
Short Time Only: 11:15 AM
Long Time Only: 11:15:51 AM
Local Time: 8/3/10 11:15:51 AM
And I am running this on a mobile emulator and double checked that the emulator time is consistent with my PC’s time!
I know this must be a very minor mistake… So if anyone can point it out, it would be much appreciated. Does it have to anything to do with GMT or UTC or any culture?
Is the mobile device set to not use daylight savings time? and is set to the same time but not the same local time offset?