note 58773 added to function.gmdate

From: Date: Tue, 15 Nov 2005 16:40:30 +0000
Subject: note 58773 added to function.gmdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-98618@lists.php.net to get a copy of this message
Hi i was having a problem in converting a date to any time zone so I wrote my own function which coverts a given date and time to other time zone equivalent function printByTimeZone($mytime,$mydate,$mytimezone) { //assuming timezone in format +05:00 or -4:30 $conTime = $mytime; $conDate = $mydate; $tzonehr=substr($mytimezone,1,2); $tzonesec=substr($mytimezone,4,2); $sign= substr($mytimezone,0,1); $timezone=intval($tzonehr)*60 + ( intval($tzonesec)*3600); Switch($sign) { Case “-“: $timezone=$timezone*(-1); Break; } // write a method to extract your hours,min,sec,day,month,year (all should be in numeric form) $TimeStamp= mktime($yourhours, $yourmins,$yoursecs,$yourmonth,$yourday ,$youryear ,-1); $TimeStamp=$TimeStamp+$_GET['TimeZone']; $GMTDateTime=gmdate("H:i:s D M d Y",$TimeStamp); return $GMTDateTime; } ---- Manual Page -- http://www.php.net/manual/en/function.gmdate.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58773 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58773&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58773&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58773&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58773&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58773&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58773&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58773&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58773&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98618) next »