note 69268 added to function.date

From: Date: Tue, 29 Aug 2006 12:45:42 +0000
Subject: note 69268 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-116468@lists.php.net to get a copy of this message
Slightly modified the code provided by "martin at smttuk dot com" so that you can give the function a date and/or time that you choose; <?php function zonedate($layout, $countryzone, $daylightsaving, $time) { if($daylightsaving) { $daylight_saving = date('I'); if($daylight_saving){ $zone=3600*($countryzone+1); } } else { if( $countryzone>>0){ $zone=3600*$countryzone; } else { $zone=0; } } if(!$time) { $time = time(); } $date = gmdate($layout, $time + $zone); return $date; } ?> For example if I wanted the time and date of my birthday in New Zealand time; <?php echo zonedate('Y-m-d H:i:s',-12,true,mktime(18,46,0,9,7,1986)); ?> ---- Server IP: 202.89.36.242 Probable Submitter: 210.86.115.60 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/69268 Del: integrated -- https://master.php.net/note/delete/69268/integrated Del: useless -- https://master.php.net/note/delete/69268/useless Del: bad code -- https://master.php.net/note/delete/69268/bad+code Del: spam -- https://master.php.net/note/delete/69268/spam Del: non-english -- https://master.php.net/note/delete/69268/non-english Del: in docs -- https://master.php.net/note/delete/69268/in+docs Del: other reasons-- https://master.php.net/note/delete/69268 Reject -- https://master.php.net/note/reject/69268 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116468) next »