get how minutes has passed with time()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

get how minutes has passed with time()

Post by psychotomus »

How can I get how minutes have passed using time();
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

time() / 60

:? is that what you are asking? Or do you want it in relation to a specific time?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

time()/60 will give you the number of minutes since January 01st, 1970, correct?

You'll need a starting time to compare the minutes passed with.

Code: Select all

$starttime = some unix timestamp;
$endtime = time();

$timepassed = ($endtime-$starttime)/60;
echo $timepassed;
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

You probably want to round() that... 3.4238742 minutes isn't all that appealing.
Post Reply