...

View Full Version : Comparing timestamps - Finding the oldest



PrincipalWisdom
05-19-2004, 03:27 AM
If I had 10 variables that were holding 10 different timestamps, and I wanted to compare them so I could find out which variable was holding the oldest timestamp, how would I go about doing that?

litebearer
05-19-2004, 04:12 AM
easiest way is to put thme in an array the simply sort the array


$time_ts[] = first timestamp;
$time_ts[] = 2nd timestamp;
etc

then

sort($time_ts);

and presuming you have 10 items

$i= 0;
for ($i = 0; $i < 10; $i ++) {
echo $time_ts[$i];
}

firepages
05-19-2004, 04:59 AM
you can also use min() to find the lowest value



<?
echo min( $time_ts ) ;
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum