Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

booter, forget it :-) Even treating the date as a string, you'd have problems.

Quite apart from trying to parse something like '310919':

1. Could it be ddmmyy? No (31 > days in Sept)

2. Could it be mmddyy? No (31 > months in year)

3. Could it be yyddmm? No (19 > months in year)

4. Could it be yymmdd? Yes! (1931:Sept:19)

treating user input as a:

"numberic [which] cannot start with 0"

raises so many issues that IMO it would be better to rethink your 'pin number' concept.

How, for example, are you going to prompt for user input?:

Enter your birthday in any format: yyyymmdd yyyyddmm yymmdd (unless your birthday is between 1900 and 1909, or sin +ce 2000) yyddmm (unless your birthday is between 1900 and 1909, or sin +ce 2000) ddmmyyyy (unless your birthday is before the 10th of the mont +h) mmddyyyy (unless your birthday is between January and Septemb +er) ddmmyy (unless your birthday is before the 10th of the month) mmddyy (unless your birthday is between January and September +)

How to explain that if the user's birthday is '030303', they have no choice but to enter '19030303' (if they're very old) or '20030303' (if they're very young)??

There must be a better way to do it!

dave


In reply to Re: Numeric Date Validation by Not_a_Number
in thread Numeric Date Validation by booter

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 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
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2021-06-25 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (134 votes). Check out past polls.

    Notices?