#!/usr/local/bin/perl
# getdate - print date of Unix time number (default current time)

if ($#ARGV+1) {
    $_=$ARGV[0];
} else {
    $_=time;
}
print (getdate($_),"\n");

exit;

#########

sub getdate {
    # converts the unix date into something a little more readable

    local($t);                  # this is just a temp value
    local($unix_date)=$_[0];    # this is the unix date
    local($mday,$hour,$min,$mon,$year);    # the date fields
    local($timestring);         # the time in hh:mm format
    local($return);             # return value

    ($t,$min,$hour,$mday,$mon,$year,$t,$t,$t) =
	localtime($unix_date);
    $mon = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon];
    $year += 1900;
    $timestring = sprintf("%02d:%02d",$hour,$min);
    $return = "$mon $mday, $year $timestring";
    $return;
}  # end of getdate
