Determine if in DST or not — IsInDaylightSavings()

Is there a way to determine if a ZonedDateTime (in the past) is in DST or not?

Jon Skeet
people
quotationmark

Yes, we've actually made this nice and easy - you just need to call ZonedDateTime.IsDaylightSavingTime. This is implemented by:

  • Obtaining the ZoneInterval from the time zone at the instant represented by the ZonedDateTime
  • Obtaining the Savings part of that ZoneInterval
  • Comparing that with Offset.Zero

people

See more on this question at Stackoverflow