I am trying to insert a date value '2010-03-14 02:00:00 AM'(Day light saving start time for 2010 year) in a datetime field of a table in sql server 2005. The date is saved as '2010-03-14 03:00:00 AM' The se开发者_JS百科rver is installed in US(EST time zone).
Can anyone tell me the reason why the date is saving differently?
Thanks Rupa
As the clock jumps from 0200 to 0300 one of these times does not exist.
Wikipedia says
A digital display of local time does not read 02:00 exactly at the shift, but instead jumps from 01:59:59.9 either forward to 03:00:00.0 or backward to 01:00:00.0.
In my view you should save all times in a database in GMT/UTC and only use the local time zone on display in the client - thus in the database all times will be monotonically increasing (that is the times will not jump back at the end of daylight saving)
GMT != UTC. GMT has Daylight Savings, UTC does not. Save your dates as UTC and you're good to go.
one point: GMT by definition does not change throughout the year: in Britain one exists either on GMT or on BST (British Summer Time).
That aside, I would recheck your time zone settings for your db and your server.
精彩评论