PHP date/time function formating
Posted on 2007-10-14
I am building a web site to track the amount of time spent on a project. basicly it has a form that when i click the submit button it records the time into a sql database as a start time, then the next click as a stop time. I am doing this in PHP and MYSQL. when it records the data, it is the number of seconds since jan 1 1970 useing the time() function.
I created a report to list the times and i use the format print date("g:i:s a", $items["start"]) and that give me the time it was recorded. and then at the end of the report i have it total up the records and i get the total seconds useing the function print date("h:i:s",$total). again it works but my hours are always set at 6. I am guessing that this is because of the time zone differance. i am in CST. is there a work around for this? or is there a better way to handle this?