djinnrutger
asked on
PHP date/time function formating
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?
Thanks!
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?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked Perfect!
Or write you own function to print out the seconds. Guess information will also be lost if the total exceeds 24h which will start from 0 again.