SQL Server convert date to specific format

53 views Asked by At

How do I convert the date column to this format:

"dateUpdated": "2024-03-20T15:36:56.897Z"

If my date in the SQL Server database is such

2024-03-20T15:36:56.8970000

The best I could find so far is

select convert(varchar, getdate(), 126) as 'Date'

But it does not give me that Z for a time zone option, which I need to have to have.

My database is an Azure SQL Server instance (if it matters)

0

There are 0 answers