Reputation: 2218
I am working on an ASP.NET application.
I want to know how to check if a specific date lies in the Daylight Saving Time period in Australia.
For example, I want to check 12/12/2013 12:30PM
is in Daylight Saving Time in Australia or not.
Upvotes: 0
Views: 1273
Reputation: 95
NodaTime library by Jon Skeet exposes Tzdb as one of the DateTimeZoneProviders.
public void Test_NodaTime_IsDaylightSavingTime()
{
var ts = new DateTime(1980, 4, 15, 12, 0, 0);
var local = LocalDateTime.FromDateTime(ts);
var zdt = Utils.TzEast.ResolveLocal(local, Utils.CustomResolver);
Assert.IsFalse(zdt.IsDaylightSavingTime());
}
https://www.timehubzone.com/time/zones
Upvotes: 0
Reputation: 241420
You will need to know the specific time zone you are talking about. Australia has 5 major time zones, and 13 discrete entries in the TZDB. You can read more here.
For the conversion, use TimeZoneInfo
, or Noda Time.
You should also read the timezone tag wiki.
If you can be more specific, and show code for what you have tried, I will update this answer with a more detailed response.
Upvotes: 1