Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
DateTime does say: "This module does not parse dates!" so that's out.

I use DateTime to parse dates (and times) all the time. However, usually I'm parsing some specific pre-defined format, such as the format used by a particular RDBMS, the format used in email headers, or the format found in Apache log files; there are corresponding DateTime::Format::Foo modules for a wide variety of these.

General-purpose "whatever format the user types" date parsing is a fundamentally intractable problem, because the user will type junk like "6/8", and without further context there is absolutely no way to know what they mean. The five most likely answers are probably (not necessarily in this order) June of 2008, June 8th of the current year, August 6th of the current year, June 8th in the adjacent year (coming year if it's past June 8th already, previous year otherwise), and August 6th in the adjacent year. When getting date input from users, the only really reasonable approach I've discovered so far is to ask for the year, the month, and the day, each in its own appropriately labeled field.


In reply to Re: Human-readable date formats by jonadab
in thread Human-readable date format strings by thewebsi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-03-29 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found