Example:
$name::$address::$date::$team
Charles,Italy,1 Jan 03,Skunks
I record every day new data. Then I use script to display data for diferent purposes. I can't figure out how to sort all data for team XXX by date.
I can make array with all record for $team but I have no idea how to sort data in array by date. I guess I am on wrong track. :-(
In what format should I record $date (date of record) so I can use it later to sort data by date?
I am really new to CGI and there is probably very simple solution.
thanks for help
Charles
use POSIX;
$timestamp = mktime($seconds,$hours,$minutes,$date,$month,$year,0,0,0);
Once you've finished the sorting, you can convert a timestamp back into a 'human' format with the time() function, eg:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=time($timestamp);
@days=("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
@months=("Jan","Feb","Mar","Apr","May","Jun","July","Aug","Sep","Oct","Nov","Dec");
$year+=1900;
if ($sec < 10) {$sec="0".$sec;}
if ($min < 10) {$min="0".$min;}
$displaytime="$days[$wday], $mday $months[$mon] $hour:$min";