#! /srvtools/http/bin/perl

#############################################################################
#
#   GetDate
#
#   INPUT:      VOID
#   OUTPUT:     date
#
#   FUNCTION:   returns current date
#
#############################################################################
require "ctime.pl";

sub GetDate{
    local($offset) = @_;
    local($date, $a, $b, $c, $d, $e, $f);

    $date = &ctime(time - $offset);
    chop($date);

    # date is in format $day $month $date $time $timezone $year
    ($a, $b, $c, $d, $e, $f) = split(/\s+/, $date);
   
    ### Month
    $_ = $b;
    s/Jan/01/;
    s/Feb/02/;
    s/Mar/03/;
    s/Apr/04/;
    s/May/05/;
    s/Jun/06/;
    s/Jul/07/;
    s/Aug/08/;
    s/Sep/09/;
    s/Oct/10/;
    s/Nov/11/;
    s/Dec/12/;
    $date = $_."/";
    ### Day
    $c = "0".$c if $c < 10;
    $date .= $c;
    ### Year
    # Eliminate the century
    if ($f =~ /^19/) {
      $f =~ s/19//;
    }
    elsif ($f =~ /^20/) {
      $f =~ s/20//; 
    }
    $date .= "/".$f;
    $date;
}
1;
