<?php
// I am using the convention (assumption) of "07/04/2004 14:45" $processdate = "07/04/2004 14:45";
// gmttolocal is a function // i am passing it 2 parameters: // 1)the date in the above format and // 2)time difference as a number; -5 in our case (GMT to CDT) echo gmttolocal($processdate,-5);
function gmttolocal($mydate,$mydifference) { // trying to seperate date and time $datetime = explode(" ",$mydate); // trying to seperate different elements in a date $dateexplode = explode("/",$datetime[0]); // trying to seperate different elements in time $timeexplode = explode(":",$datetime[1]);
// getting the unix datetime stamp
$unixdatetime = mktime($timeexplode[0]+$mydifference,$timeexplode[1],0,$dateexplode[0],$dateexplode[1],$dateexplode[2]);
// return the local date return date("m/d/Y H:i",$unixdatetime)); }
?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php