Formatting SYSDATETIMEOFSFS in SQL Server 2008

I am currently using the SYSDATETIMEOFFSET() function in SQL Server and I want to format the output that is generated from the function

 2011-11-25 16:08:45.9281159 +05:30 

I want to remove the extra nano-seconds, for example, I want to get the following result.

 2011-11-25 16:08:45 +05:30 
+4
source share
1 answer

Try the following:

 SELECT CAST(SYSDATETIMEOFFSET() AS DATETIMEOFFSET(0)) 

You can determine how accurate and accurate your DATETIMEOFFSET will be - with 0 , because accuracy gives you seconds - but without a split second.

+3
source

Source: https://habr.com/ru/post/1383038/


All Articles