Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Best way to get DD.MM.YY

by BigLug (Chaplain)
on Dec 12, 2005 at 23:18 UTC ( [id://516176]=note: print w/replies, xml ) Need Help??


in reply to Best way to get DD.MM.YY

The obligatory DateTime solution:
DateTime->now()->strftime('%d.%m.%y')
That out of the way, let me say that either DD.MM.YY or MM.DD.YY is a crazy way of dealing with dates. Neither is sortable and the two are not distinguishable for 144 days of the year. An ISO date/time format solves this: YYYY-MM-DDTHH:MM:SS

However if all you're doing is displaying the date to a known audience who have either asked, or specified that this is the best *display* format, then go ahead.

I'd still argue however that a two-digit year is fraught with danger .. remember the Y2K bug? This is it!

Cheers!
Rick

Replies are listed 'Best First'.
Re^2: Best way to get DD.MM.YY
by samtregar (Abbot) on Dec 13, 2005 at 00:16 UTC
    Or, better yet:

    my $dmy = DateTime->now()->dmy('.');

    I discovered the mdy() method a few days ago and it's a pretty sweet time-saver. I guess dmy() would be the equivalent outside the US.

    -sam

      Thanks Sam! I'd completely forgotten the dmy & mdy methods!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-20 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found