Daylight saving time (DST), is the practice of advancing clocks (typically by one hour) during warmer months so that darkness falls at a later clock time. The typical implementation of DST is to set clocks forward by one hour in the spring ("spring forward") and set clocks back by one hour in autumn ("fall back") to return to standard time. [from Wikipedia]
Write a program (full or function), takes no input from user, tells user when next Daylight Saving Time clock shift will happen in the following year for users' timezone (as configured on users' system / environment). Output should be the time when DST starts / ends in second precision, or output some other non-ambiguous text / value to tell user there will be no DST start / end happened in the following year.
- This is code-golf, shortest codes in bytes win as usual;
- Your program should running on a platform which support at least 12 different timezone, and at least 2 of them have different DST shifts in the following year. So a program simply tells user "there is no DST" on a platform only support UTC would be disqualified.
- You may output in any reasonable format including (but not limited to) any one of following formats. Please also specify your output format in your post.
- A Unix timestamp in second / millisecond;
- Any human readable string in UTC or users timezone;
- A built-in date time type value as return value of function;
- If your program output time in users' timezone, you should clarify whether the time outputted had DST counted. This can be done by including UTC offset / timezone name in your output, or specify it in your post (only when all outputs both use / not use DST.
- For timezone uses DST whole year, you program should tell user no DST start / end will happen;
- If your program running in some sandbox / emulator / virtual machine / docker environment which provides its own timezone config, you may use the timezone info configured in the runtime environment instead of user's operating system. But again, the environment should support multiple timezone with different DST to make your answer valid.
To keep this challenge simple, you may assume:
- The timezone will not change its offset to UTC due to other reasons;
- The offset to UTC of the timezone is an integer in seconds (both before / after DST);
- The timezone will start / end its DST when Unix timestamp (as in second) is an integer;
- The timezone will either start / end its DST in the following year or it will never start / end its DST (No DST applied or use DST whole year);
Following example outputs assume user is running your program in 2021-06-01T00:00:00Z. Your program may need to have different behavior as time past.
America/Anchorage * 1636279200 * 2021-11-07T10:00:00.000Z * Sun Nov 07 2021 01:00:00 GMT-0900 (Alaska Standard Time) * Sun Nov 07 2021 02:00:00 GMT-0800 (Alaska Daylight Time) Australia/Adelaide * 1633192200 * 2021-10-02T16:30:00.000Z * Sun Oct 03 2021 03:00:00 GMT+1030 (Australian Central Daylight Time) * Sun Oct 03 2021 02:00:00 GMT+0930 (Australian Central Standard Time) Asia/Singapore * No DST