note 23169 deleted from function.date by sniper

From: Date: Sat, 11 Oct 2003 16:50:11 +0000
Subject: note 23169 deleted from function.date by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58259@lists.php.net to get a copy of this message
Note Submitter: MasterNES@aol.com ---- If you get the current date in a different timezone, try this function: /* $current should be the timezone on the current machine, $target is the timezone you want to calculate. Both should be in hours. For example, GMT -05:00 should be -5. GMT +12:00 should be 12. You can use the returned timestamp with the date function. ex: echo date('r', zonechange(-5, 10)); would echo the date for a +10:00 timezone on a machine in -05:00. */ function zonechange ($current, $target) { $current = -1 * $current; $zonedate = mktime(date('G'), date('i'), date('s'), date('n'), date('j'), date('Y'), 1) + (($current + $target) * 3600); return $zonedate; }

« previous php.notes (#58259) next »