note 75735 added to function.gmmktime

From: Date: Wed, 13 Jun 2007 19:57:52 +0000
Subject: note 75735 added to function.gmmktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-127456@lists.php.net to get a copy of this message
Beware that despite the documentation which states is_dst is ignored, with PHP 5.2 at least, it is not actually ignored and will cause a 1 hour offset on the UTC time returned. This caused some interesting bugs, especially with the tzdelta function shown from previous posts below - you need to make the final parameter a 0 instead of $ar[8] otherwise you get an off-by-1-hour as a result. As a result, I now use : 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], 0); return ( $iTztime - $iTime ); } ---- Server IP: 194.145.210.4 Probable Submitter: 80.229.167.120 ---- Manual Page -- http://www.php.net/manual/en/function.gmmktime.php Edit -- https://master.php.net/note/edit/75735 Del: integrated -- https://master.php.net/note/delete/75735/integrated Del: useless -- https://master.php.net/note/delete/75735/useless Del: bad code -- https://master.php.net/note/delete/75735/bad+code Del: spam -- https://master.php.net/note/delete/75735/spam Del: non-english -- https://master.php.net/note/delete/75735/non-english Del: in docs -- https://master.php.net/note/delete/75735/in+docs Del: other reasons-- https://master.php.net/note/delete/75735 Reject -- https://master.php.net/note/reject/75735 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127456) next »