Page 1 of 1

Daylight Saving Time

Posted: Sat Apr 22, 2017 2:44 pm
by PowerSoft
I need to detect in my program if the DST is active.

Is it posible to do this in PB?

Have looked into the forum but with no results. :(

Appreciate any help :lol:

Re: Daylight Saving Time

Posted: Thu Apr 27, 2017 8:12 am
by RSBasic

Code: Select all

EnableExplicit

Define TIME_ZONE_INFORMATION.TIME_ZONE_INFORMATION

Select GetTimeZoneInformation_(TIME_ZONE_INFORMATION)
  Case #TIME_ZONE_ID_UNKNOWN
    Debug "Daylight saving time is not used in the current time zone, because there are no transition dates or automatic adjustment for daylight saving time is disabled."
  Case #TIME_ZONE_ID_STANDARD
    Debug "The system is operating in the range covered by the StandardDate member of the TIME_ZONE_INFORMATION structure. "
  Case #TIME_ZONE_ID_DAYLIGHT
    Debug "The system is operating in the range covered by the DaylightDate member of the TIME_ZONE_INFORMATION structure."
EndSelect

(only Windows)

\\Edit:
Oh, I'm sorry. You are using MacOS.
I don't know but you can read this sites:
https://developer.apple.com/reference/f ... n/timezone
https://developer.apple.com/reference/f ... transition

Re: Daylight Saving Time

Posted: Thu Apr 27, 2017 4:24 pm
by Sicro
A few days ago I added a code for it, which would have to work on Windows, Linux and Mac:
https://github.com/SicroAtGIT/PureBasic ... ngTime.pbi

I think this thread is a duplicate of:
GetTimeZoneInformation_