Re: Need help with formatting time

From: Date: Tue, 17 Jul 2001 21:04:49 +0000
Subject: Re: Need help with formatting time
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58330@lists.php.net to get a copy of this message
John Holcomb pressed the little lettered thingies in this order... > 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. > $minutes = 780; $some_time = date("g:i a",mktime(0,$minutes,0,01,01,2000)); echo $some_time; The combination of date() and mktime() can do just about anything with dates and times that you could ever possibly dream of doing (it can even do some nifty stuff with english ordinal suffixes that have nothing to do with dates or time). http://www.php.net/manual/en/function.date.php http://www.php.net/manual/en/function.mktime.php Christopher Ostmo a.k.a. tech@AppIdeas.com AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) Business Applications: http://www.AppIdeas.com/ Open Source Applications: http://open.AppIdeas.com/

« previous php.general (#58330) next »