/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] determining if in DST

Hello,

I need to be able to return true or false if a given timezone is currently in DST or not. I noticed is_dst is a deprecated function so I was wondering what the best alternative to that is.

Basically, I have the timezone name of the logged in user ($timezone_name) returning already, so I just need to check against that if it is in dst or not.

Any help would be appreciated. I know it’s probably something simple that can be done.

Thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 12.2011 — One way that should work with most PHP versions:
[code=php]
date_default_timezone_set($timezone_name);
$isDST = (bool) date('I');
[/code]
Copy linkTweet thisAlerts:
@mich5blueauthorMay 13.2011 — awesome, thanks man. Just what I needed. Works perfectly!
×

Success!

Help @mich5blue spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...