Daylight Saving Time

Just starting out? Need help? Post your questions and find answers here.
PowerSoft
User
User
Posts: 65
Joined: Sun Aug 16, 2015 2:54 pm

Daylight Saving Time

Post 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:
OS X 10.10.5 PB 5.31(x64)
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Daylight Saving Time

Post 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
Image
Image
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: Daylight Saving Time

Post 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_
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Post Reply