Friday, 15 June 2012

How to store timezone in SQL Server 2005 -


I am creating a web application where users can enter events,

  • Event title
  • Start date / time
  • Description

Users will want to enter start date / time with a timezone that accompanies that location accident. Events are all over the world, so the timezone can change from event to event.

In the SQL Server backend database, I am using date time for the start date / time. Which column should I use to store the time zone? Int? Name? Decimal?

The time zone is tricky, bad things. They are usually stored as UTC offsets, but even there are issues related to things like changing the time of daylight savings (if at all).

If you are using SQL Server 2008, then you use a datetimeoffset type, which includes the UPS offset with the value otherwise you will need two columns.


No comments:

Post a Comment