Getdate() function to get date for my timezone

后端 未结 5 1052
执念已碎
执念已碎 2021-01-05 05:49

I would love to insert a default value into a column with data type datetime2(7). However, because my website is hosted on a server in a different timezone, the getdate func

5条回答
  •  逝去的感伤
    2021-01-05 06:09

    Just store the data in UTC, and use a calendar table to calculate offsets when you read the data (see these tips: part 1, part 2, part 3). Related:

    GET UTC Date of a past date

    Daylight saving time and time zone best practices

    Best Practices working with Datetimeoffset

    how to convert all datetime columns in a sql server 2005 express database with data to UTC

    Where to set a UTC datetime value in n-tier application: Presentation Layer, Domain, or Database?

    How do I handle the timezones for every Chat message

提交回复
热议问题