How to convert / cast the current server date and time to a varchar in the format YYYY-MM-DDThh:mm:ss[+|-]hh:mm in T-SQL
To convert the current machine date and time to a varchar in the format YYYY-MM-DDThh:mm:ss[+|-]hh:mm in T-SQL, you can use the following code: select convert(varchar(100), cast(sysdatetimeoffset() as datetimeoffset(0)), 126) Result (in Amsterdam in…