LinuxSA Mailing list archives
Index:
[thread]
[date]
[subject]
[author]
From: Andrew Speer <andrew.speer@isolutions.com.au>
To :
Date: Fri, 07 Jan 2000 14:17:04 +1030
Re: Y2K (year=100)
Not that I am bored or anything ...
A semi-known perl trick to get a quick date (If only it was this easy to get
a date in real life ! No sarcastic replies please !)
perl -e 'my $date=scalar localtime; print $date'
gives:
Fri Jan 7 13:37:27 2000
And for those who think perl is unreadable (this is a script, not run from
command line):
my $ddmmyyyy=join('/',do {local @_=(localtime())[3..5]; map
{$_=sprintf('%2.2d',$_)} @_; $_[1]++; $_[2]+=1900; @_}); ## <-- All one
line, or split on a ";"
print $ddmmyyyy;
gives:
07/01/2000
Unreadable .. Never !
Andrew
Index:
[thread]
[date]
[subject]
[author]
Return to the LinuxSA Mailing List Information Page