Posted by Chris Hope on 03/29/07 08:00
Arne Gemsa wrote:
> I want to get a starttime. To get this I have to subtract the runtime
> from a unit e.g. 08:40:15 from a date e.g. 2007-03-29 16:48:30. So the
> starttime is 2007-03-29 08:08:15.
>
> Is there any function in php to do so, or must I do it by myself?
http://php.net/strtotime will convert it to a timestamp, then you can
subtract the appropriate amount of time (hint - in seconds) and then
reformat using http://php.net/date
Or you can use http://php.net/mktime after working out the current year,
month etc with http://php.net/date and then adding/subtracting the
appropriate hours and minutes etc.
--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Navigation:
[Reply to this message]
|