C++ – Routine to check if a given date is summertime or wintertime

c++datetimewinapi

Do you know if an API exists for that checking?

Best Solution

GetTimeZoneInformation is what you need.

You can call it and inspect the returned value to detect whether daylight saving is on at the moment of call. It also fills a structure that contains rules for switching to daylight saving and from daylight saving. Having this structure filled and any given time in UTC format you can relatively easily compute whether that time corrspongs to daylight saving time or standard time.