Re: Project TIME calculated, in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1 May 2010 22:02, Richard Quadling <rquadling@xxxxxxxxxxxxxx> wrote:
> On 1 May 2010 18:48, justino garcia <jgarciaitlist@xxxxxxxxx> 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>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux