note 86504 added to function.date

From: Date: Wed, 22 Oct 2008 13:41:56 +0000
Subject: note 86504 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-145587@lists.php.net to get a copy of this message
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: //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: if(est_isdst()) { echo 'Its DST in EST Timezone!'; } ---- Server IP: 208.69.120.35 Probable Submitter: 96.244.142.5 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/86504 Del: integrated -- https://master.php.net/note/delete/86504/integrated Del: useless -- https://master.php.net/note/delete/86504/useless Del: bad code -- https://master.php.net/note/delete/86504/bad+code Del: spam -- https://master.php.net/note/delete/86504/spam Del: non-english -- https://master.php.net/note/delete/86504/non-english Del: in docs -- https://master.php.net/note/delete/86504/in+docs Del: other reasons-- https://master.php.net/note/delete/86504 Reject -- https://master.php.net/note/reject/86504 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145587) next »