note 29651 added to function.localtime

From: Date: Thu, 20 Feb 2003 06:12:35 +0000
Subject: note 29651 added to function.localtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-44245@lists.php.net to get a copy of this message
To calculate the delta between the local time and UTC: function tzdelta ( $iTime = 0 ) { if ( 0 == $iTime ) { $iTime = time(); } $ar = localtime ( $iTime ); $ar[5] += 1900; $ar[4]++; $iTztime = gmmktime ( $ar[2], $ar[1], $ar[0], $ar[4], $ar[3], $ar[5], $ar[8] ); return ( $iTztime - $iTime ); } So if your system is in DST, tzdelta should return -18000 (five hours less). -- http://www.php.net/manual/en/function.localtime.php http://master.php.net/manage/user-notes.php?action=edit+29651 http://master.php.net/manage/user-notes.php?action=delete+29651 http://master.php.net/manage/user-notes.php?action=reject+29651

« previous php.notes (#44245) next »