Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert UTC to Australian Eastern Daylight Time (AEDT)? [duplicate]

We are downloading data from our trading partner's API. Till now we were working with "E. Australia Standard Time" and it was working fine.

After daylight saving started our trading partner said that they are working with "Australian Eastern Daylight Time (AEDT)".

I have used following code to convert from UTC to "E. Australia Standard Time".

DateTime utcTime = DateTime.UtcNow;
TimeZoneInfo objTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("E. Australia Standard Time");
DateTime TPDateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, objTimeZoneInfo);

But I am getting following errors when I use "E. Australia Daylight Time" or "Australian Eastern Daylight Time (AEDT)"

The time zone ID 'E. Australia Daylight Time' was not found on the local computer.
The time zone ID 'Australian Eastern Daylight Time (AEDT)' was not found on the local computer.

What timezone id should I pass to FindSystemTimeZoneById() method to convert correctly to Australian Eastern Daylight Time (AEDT)?

like image 663
Yash Avatar asked Nov 22 '18 15:11

Yash


People also ask

What is AEDT time in UTC?

Currently has same time zone offset as AEDT (UTC +11) but different time zone name. Australian Eastern Daylight Time (AEDT) is 11 hours ahead of Coordinated Universal Time (UTC). This time zone is a Daylight Saving Time time zone and is used in: Australia.

What is the UTC time in Australia?

Australia uses three main time zones: Australian Western Standard Time (AWST; UTC+08:00), Australian Central Standard Time (ACST; UTC+09:30), and Australian Eastern Standard Time (AEST; UTC+10:00).

How far ahead is UTC from AEST?

Australian Eastern Standard Time (AEST) is 10 hours ahead of Coordinated Universal Time (UTC). This time zone is in use during standard time in: Australia.


1 Answers

You probably want to use "AUS Eastern Standard Time" (for Canberra, Hobart, Melbourne and Sydney). Despite having the word "Standard" in the name, this accounts for daylight savings time and uses UTC+10 in winter and UTC+11 in summer:

var tz = TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time");

TimeZoneInfo.ConvertTimeFromUtc(new DateTime(2018,1,1,0,0,0,DateTimeKind.Utc), tz); 
    // => 01/01/2018 11:00:00
TimeZoneInfo.ConvertTimeFromUtc(new DateTime(2018,7,1,0,0,0,DateTimeKind.Utc), tz); 
    // => 01/07/2018 10:00:00

The "E. Australia Standard Time" time zone is for Brisbane, where they do not observe daylight savings time.

You can get a complete list of available time zones using the TimeZoneInfo.GetSystemTimeZones() method, or by running tzutil /l at the command line.

like image 137
Phil Ross Avatar answered Sep 21 '22 02:09

Phil Ross