> -----Original Message-----
> From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 26, 2002 3:20 PM
> To: '[EMAIL PROTECTED]'
> Subject: Calculating currentdate without the time module
>
>
> Gidday all,
>
> The time module has not been installed on our server and our
> server team don't have time to install it so I cant use this
> command in my script
>
> use Time::Local;
>
> but I need to calculate todays date. From the following
> script I can calculate what year it is but how to get the
> month and the day.
See script below which returns date in Aussie format :)
<snip>
print &GetDate;
sub GetDate() {
#RETURNS THE CURRENT DATE IN DD/MM/YYYY FORMAT
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
$year = $year + 1900; # $year is number years since 1900
$mon++; # with localtime months start at zero
my $day = $mday;
if (length($day)==1) {
$day = "0" . $day;
}
if (length($mon)==1) {
$mon = "0" . $mon;
}
my $date = $day . "/" . $mon . "/" . $year;
return $date;
}
</snip>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]