...

View Full Version : timestamp + string



timgolding
07-23-2007, 05:19 PM
Hi

I have a start time for a schedule and in my DB i have a duration which is a string. What I want to do is calculate the end time

end_time= start_time + (duration)

Start time is stored in the DB as a SQL Time data type. I convert it to a timestamp



$timestamp=strtotime($row['time']);
$strt_time=date("g:i", $timestamp);



So how is the best way to get end time when one is a string in hours and the other a timestamp

timgolding
07-23-2007, 05:27 PM
$timestamp=strtotime($row['time']);
$strt_time=date("g:i", $timestamp);
$coef=(int)($row['duration']);
$end_time=date("g:i", $timestamp+($coef*3600));


This seems to work but can i rely on this?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum