Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: date parsing

by ikegami (Patriarch)
on Jun 13, 2025 at 10:35 UTC ( [id://11165397]=note: print w/replies, xml ) Need Help??


in reply to date parsing

The data of 01/09/2024 (ie the next calendar day) gives gibberish - with the day coming out as 09 instead of 1, month as 01 instead of 9 and the year as 124.

It's not gibberish; it just guessed incorrectly about the order of the day and month. Instead of using a parser that guesses at the format, use one that where you can specify the format.

Replies are listed 'Best First'.
Re^2: date parsing
by SBECK (Chaplain) on Jun 23, 2025 at 15:03 UTC
    In order to interpret 01/09 as DD/MM instead of MM/DD using Date::Manip (not Date::Parse), just add the line (near the start):
    Date_Init("DateFormat=non-US");

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2025-07-11 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.