Reply to Re: subtract time from a date

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация