DateTimeOffset.Now in T-SQL

I am performing an INSERT for db sql 2008. How do I tell T-SQL to insert NOW into the DATETIMEOFFSET column? GETDATE ()?

+49
sql datetime sql-server tsql sql-server-2008
Jun 26 '09 at 10:37
source share
2 answers

May be.

This will give you the local time of the server where SQL is installed.

Do you want to save time zone, etc. also? If yes, SYSDATETIMEOFFSET () might be better

+78
Jun 26 '09 at 10:52
source share

sysutcdatetime () is the best option if your customers are located in another part of the world and you want to use this column to filter or compare goals.

0
Jan 12 '19 at 3:03
source share



All Articles