Re: determine number of days, hours & minutes between 2 dates

From: Date: Thu, 18 Jan 2001 07:13:20 +0000
Subject: Re: determine number of days, hours & minutes between 2 dates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35288@lists.php.net to get a copy of this message
> The subject pretty much explains it all. I have 2 dates (YYYYMMDDHHSS > format) and want to determine the number of days, hours, minutes and seconds > left from the later date to the earlier date. I figure I could do all this > using date arithmatic, divide by 60 seconds in a minute, 60 minutes in an > hour, 24 hours in a day and so forth, but was wondering if there a better > (or easier way) to do this before I start coding away.? If those come from MySQL, use MySQL's date_add function. Or something like that... http://mysql.org/ If they are just from some raw text file... I'm betting that somebody has done the subtraction and formatting part for PHP dates, so you just need to use http://php.net/substr and http://php.net/mktime Check the code archives linked from http://php.net/links.php for date algorithms. By Day: |By Night: Don't miss the Zend Web Store's | There's not enough room here... Grand Opening on January 23, 2001! | Start here: http://www.zend.com | http://l-i-e.com/artists.htm

« previous php.general (#35288) next »