4

What is the recommended best practice when it comes to storing date/time for an application that needs to support multiple timezones?

Which is best ?

  • Use the SQL DateTime data type and insert date/time as UTC (e.g. convert local time to UTC in application business layer and pass to DB already in UTC format)
  • Use the SQL DateTimeOffset data type which will record the offset relative to UTC?
RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536
Matt F
  • 263
  • 2
  • 7

1 Answers1

1

Use the DateTimeOffset datatype. Each server would store the data locally in its own timezone, storing the offset from UTC as well. When data is gathered to a central area, you can easily convert to UTC for comparison purposes.

datagod
  • 7,141
  • 4
  • 38
  • 58