note 86504 deleted from function.date by derick

From: Date: Sun, 22 Mar 2009 18:46:20 +0000
Subject: note 86504 deleted from function.date by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152303@lists.php.net to get a copy of this message
Note Submitter: kyle renfrow ---- i figured i would post this, it's only useful for systems dealing with UTC and EST, but could easily be modified to support multiple timezones. this function will tell you whether it's daylight saving time for the eastern timezone using UTC localtime: <?php //checks whether DST in EST using UTC //can pass $time in unix timestamp, otherwise uses time() function est_isdst($time=NULL){ if(!$time) { $now = time(); }else { $now = $time; } if ( $now > strtotime(date('Y-m-d 6:59:59', strtotime('next Sunday', strtotime(date('Y', $now).'-3-7')))) && $now < strtotime(date('Y-m-d 6:00', strtotime('first Sunday', strtotime(date('Y', $now).'-11-0')))) ) { return true; }else { return false; } } ?> USAGE: <?php if(est_isdst()) { echo 'Its DST in EST Timezone!'; } ?>

« previous php.notes (#152303) next »