Re: Project TIME calculated, in PHP
| From: | Peter Lind | Date: | Sun, 02 May 2010 08:11:06 +0000 |
| Subject: | Re: Project TIME calculated, in PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304840@lists.php.net to get a copy of this message | ||
On 1 May 2010 22:02, Richard Quadling <rquadling@googlemail.com> wrote:
> On 1 May 2010 18:48, justino garcia <jgarciaitlist@gmail.com> wrote:
>> tImeArrived = CDate(InputBox("Enter START time:", "Start time",
>> "9:00 AM"))
>> TimeLeft = CDate(InputBox("Enter END time:", "End time", "1:24
>> PM"))
>> Minutes = DateDiff("n", TimeArrived, TimeLeft)
>> Hours = Int(Minutes / 60)
>> Minutes = Minutes - (Hours * 60)
>> TotalTime = Format(Hours, "0") & ":" & Format(Minutes,
>> "00")
>>
>> I did something like this in VBA, but I want to create something for PHP..
>>
>> How can extract an am or pm from the input string, convert to 24 hours for
>> calculations, then convert back to 12 hour am/pm format in PHP?
>>
Consider the DateTime class, might suit your needs.
http://dk2.php.net/manual/en/class.datetime.php
Regards
Peter
--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>