fabien
fabien

Reputation: 2111

get hour/timezone on azure server

How can you know which hour/timezone is used on azure (within a worker role for instance) ? how does it work when servers are loadbalanced ? Would you use some kind of ntp server to synchronize instead ?

Upvotes: 2

Views: 1713

Answers (2)

Alex S
Alex S

Reputation: 1221

I created service in Azure and code snippet to get actual Azure time

http://azuretime.azurewebsites.net/datetimeoffset

private async Task<DateTimeOffset> GetAzureTimeAsync()
{
    using(var client = new HttpClient())
    {
        return DateTimeOffset.Parse(await client.GetStringAsync("http://azuretime.azurewebsites.net/datetimeoffset")).ToUniversalTime();        
    }   
}

Get Azure Time

Upvotes: 0

Alex
Alex

Reputation: 521

Azure servers all run on UTC Time. See http://blogs.msdn.com/b/ericgolpe/archive/2010/12/29/windows-azure-date-time-and-locale.aspx for more information.

Upvotes: 6

Related Questions