Cool use for gmstrftime...

From: Date: Mon, 23 Jun 2003 17:09:51 +0000
Subject: Cool use for gmstrftime...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-152513@lists.php.net to get a copy of this message
How many times have you manually calculated the hours, minutes and seconds between two dates? I was doing that again (for the million'th and one times) and thought.... there should be a different way to do this.... Here is what I came up with (I don't know if it's more efficient than the old stand by's or not, but it is different). <?PHP $cTime = time() - filemtime( $_SERVER["SCRIPT_FILENAME"] ); printf( "Script Age: %d days %s", (int)($cTime / 86400), gmstrftime( "%H:%M:%S", $cTime ) ); ?>

« previous php.general (#152513) next »