Re: Time Processing (sum of two times)
| From: | Jack Dempsey | Date: | Fri, 12 Oct 2001 19:32:03 +0000 |
| Subject: | Re: Time Processing (sum of two times) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70950@lists.php.net to get a copy of this message | ||
convert the times to seconds, add the seconds, reconvert into a time
checkout http://php.net/date and http://php.net/mktime
jack
"A. R. M." wrote:
> Hi,
>
> Does anybody know of a way in PHP to get the sum of two times?
> For example, you have extracted "11:05:00" from one field of a
> database, and "00:56:00" from another field.
> I need to add the two and come up with something like:
> "11:05:00" + "00:56:00" = "12:01:00"
>
> In other words, the sum of two times (as in a time field).
>
> It could be used, for instance, when you're trying to add an
> appointment time and the length of the appointment to get the
> end of that appointment time, or the start of the next appointment time.
>
> Some scripting languages have functions like
> SumTimes(time1, time2) OR SumDates(date1, date2)
> OR DiffTimes(time1, time2)
>
> Any ideas how to accomplish this in PHP please?
> Thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net