Share via

Lesson Learned #4: Modifying the default time zone for your local time zone.

Currently, the default time zone on Azure SQL DB is UTC. Unfortunately, there is not possible to change by server configuration or database configuration.

All Azure services use UTC time zone settings, regardless of their physical location. This also applies for SQL Azure, so if you need a custom time zone you'll have to manage that in the middle/front end tier.

One suggestion that we have is to review the new date/time function that AZURE SQL DATABASE provided as AT TIME ZONE  and datetimeoffset  you could find out the different time zones running the query: select * from sys.time_zone_info

For example, we could create the following function:

CREATE FUNCTION dReturnDate( @dFecha as datetime)

returns DATETIME



     DECLARE @D AS datetimeoffset

     SET @D = CONVERT(datetimeoffset, @Dfecha) AT TIME ZONE 'W. Europe Standard Time'

     RETURN CONVERT(datetime, @D);


Running the query DBO.dReturnDate(getdate()) you could observe the results. Please, verify the timezone that you are working on with select * from sys.time_zone_info.