Hey guys. I have a timestamp that looks like this 05/03/2007 07:35 PM and I need to subtract/add a certain amount of hours from/to it depending on the time zone the person is in who is looking at it.
For instance, to give you an idea of the logic I am looking for
function FormatTimeZone(timeStamp,numHoursChange,subtract)
{
if(subtract == true){
//subtract numHoursChange from timeStamp
}else{
//add numHoursChange to timeStamp
}//end if
}//end function
if($timeZone == 1) $newTime = FormatTimeZone($timeStamp,$numhours,true)
The part I can't figure out is how to take into account changes in the Date and changes in AM or PM.
For instance if I had the time stamp 05/03/2007 07:35 PM and I wanted to subtract 12 hours the function would return 05/02/2007 07:35 AM....
Is this too hard to do? Or are there some built in PHP functions that can handle this?
Thank a lot guys!