$hours = $time / 60;
$minutes = $time % 60;

if($hours >= 12){
        $meridian = 'pm';
        $hours -= 12;   
}
else{$meridian = 'am';}
if($hours == 0){$hour = '12';}

echo "$hours:$minutes$meridian";

try something like that...haven't tested it, but it should be close...


-----Original Message-----
From: John Holcomb [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, July 17, 2001 3:53 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP] Need help with formatting time

Hello and thank you.

  I'm trying to find a function(method) or existing
code taht takes the number of minutes that have passed
in a day and returns the time of the day.  For
example:

 780 minutes == 1pm,
 0 minutes == 12am,
 etc,etc.....

so I'm looking for code that when you enter the number
of minutes, it returns the time of day.

example:   
     
    $some_time = foo(780);

    print($some_time);

   //prints 1:00pm


Thnaks again.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to