Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Custom date string formatting

by andyford (Curate)
on Jan 31, 2007 at 17:16 UTC ( [id://597574]=note: print w/replies, xml ) Need Help??


in reply to Custom date string formatting

You were very close to an answer. You just needed to capture the time part in fourth set of parenthesis and then toss it by not referring to it.
Assuming that there's always just one space between the date and the time:

$date =~ s/(\d{4})\-(\d{2})\-(\d{2})(\s.+)/$3\.$2\.$1/;

non-Perl: Andy Ford

Replies are listed 'Best First'.
Re^2: Custom date string formatting
by nelio (Novice) on Feb 01, 2007 at 14:04 UTC
    Yep, it really did'nt occur to me at the time. That's a clean regex solution.
    Thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found