SDU Tools: Converting to/from Unix time in SQL Server T-SQL
I do a lot of data conversion work each month. Many systems store date and time values in Unix format, so I often need to convert to/from these in T-SQL. Fortunately it’s easy.
A common way that Unix systems store the date and time value, is to store the number of seconds since the beginning of 1970.
The DateTime2ToUnixTime and UnixTimeToDateTime2 functions in our free SDU Tools for developers and DBAs, does this.
2021-01-15