DateTime.Now missing 1 hour daylight savings
Hi all Basically I have a piece of code that reads the DateTime.Now values into a struct. Passes the struct to a DLL to be stored, updated, etc.
I noticed only rec开发者_JAVA百科ently that when I sync my DLL with the DateTime.now values, the hour value is always 1 hour behind??? e.g. PC time = 17.20,,,, DLL Time = 16.20???
Also this code has always worked before the daylight savings occured, like always! I havnt changed anything in it, and I notice don my laptop when I select the clock, it mentions about the daylight saving hour.
Does anyone know why this is happening? please?
any help would be greatly appreciated
You need to check the culture of the thread that your code runs. It is not necessary the current culture of your system.
Set a breakpoint and check the value of:
System.Threading.Thread.CurrentThread.CurrentCulture
Check also the TimeZone class: http://msdn.microsoft.com/en-us/library/system.timezone(v=vs.71).aspx
精彩评论