How to find DST Cutover time

93 Views Asked by At

Is there any easy way to find DST cutover time for particular Timezone(Say America/New_York) in given Time range? I know I can write the custom logic to iterate over each hours, calculate the offset for each hour and compare it with previous hour offset. If offset is diff, that will be DST cutover time Or I can use IANA database

But I don't want to go with these approaches. I am more interested in knowing if there is any inbuilt functionality in Go or any package that provides such functionality.

1

There are 1 best solutions below

0
Amaan Ahmad On

To find the DST cutover time, you can use the following steps:

Determine the time zone you are in. Find out whether or not your time zone observes Daylight Saving Time (DST). If your time zone does observe DST, find out the start and end dates for DST. The DST cutover time is the time at which clocks are set forward or backward to observe DST. For example, in the United States, most time zones observe DST. The start date for DST is the second Sunday in March at 2:00 AM local time. The end date for DST is the first Sunday in November at 2:00 AM local time.

Therefore, the DST cutover time in the United States is:

Spring forward: Second Sunday in March at 2:00 AM local time Fall back: First Sunday in November at 2:00 AM local time In India, DST is not observed. Therefore, there is no DST cutover time in India.