note 69268 deleted from function.date by tularis

From: Date: Thu, 09 Feb 2012 21:04:04 +0000
Subject: note 69268 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186026@lists.php.net to get a copy of this message
Note Submitter: James ---- 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)); ?>

« previous php.notes (#186026) next »