Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Date format

by bjelli (Pilgrim)
on Mar 19, 2001 at 21:22 UTC ( #65465=note: print w/replies, xml ) Need Help??


in reply to Date format

Just my 0.2 XP's worth:

sub date { my($sec,$min,$h,$mday,$month,$year) = localtime(time); $year += 1900; # 2-digit year (eg. 101 = 2001) $month += 1; # month is counted from 0 return sprintf "%02d-%02d-%04d", $month, $mday, $year; }

PS: if your audience is international: don't use that format. I'm from Austria, I'm used to interpreting xx-xx-xxxx as DD-MM-YYYY. You might want to use YYYY-MM-DD instead, to avoid this confusion.

--
Brigitte    'I never met a chocolate I didnt like'    Jellinek
http://www.horus.com/~bjelli/         http://perlwelt.horus.at

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://65465]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2018-08-17 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (174 votes). Check out past polls.

    Notices?