date validation !!

This is a discussion on date validation !! within the C Programming forums, part of the General Programming Boards category; Hi ppl I want a clear code for the following. Seems that i dint make my question clear. Suppose that ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    45

    date validation !!

    Hi ppl

    I want a clear code for the following. Seems that i dint make my question clear.

    Suppose that user enters a date (say DOB) I want a routine which validates that date perfectly. (or even some sugggestions on developing that routine)

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: date validation !!

    Originally posted by rajesh23
    Hi ppl

    I want a clear code for the following. Seems that i dint make my question clear.

    Suppose that user enters a date (say DOB) I want a routine which validates that date perfectly. (or even some sugggestions on developing that routine)
    It seems the following wasn't clear enough:
    *READ THIS FIRST* Guidelines to the Board and hints for help (10-13-2002 until 11-12-2012)

    2. Don't ask people to do all your work for you, See the announcement on Homework below this one for more info about what is considered acceptable.

    Homework Policy:

    The purpose of these board is not for other people to do your homework for you. Try things out work on your own, homework has a purpose. If you still have trouble with a specific piece of code or concept please feel free to ask. But please do not ask people to do your entire homework for you, it simply annoys people most of the time.

    For an example check out this thread written by Prelude. Thanks Prelude.

    If you have any questions about what is approprate, or anything else, please E-mail or PM me and I'll be happy to answer them.

    Thank you
    Oh, no, wait. That was perfectly clear. You just didn't read it, or if you did, you didn't have enough respect for the board and its members to follow the rules.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161

    Re: date validation !!

    Originally posted by rajesh23
    Hi ppl

    I want a clear code for the following. Seems that i dint make my question clear.

    Suppose that user enters a date (say DOB) I want a routine which validates that date perfectly. (or even some sugggestions on developing that routine)
    Perfectly? Do you mean it must handle:
    9/24/03
    9/24/2003
    24/9/2003
    24Sep2003
    24-Sep-2003
    September 24, 2003
    etc?

    Or just a subset of formats?

    Decide on the format(s) you want to validate.
    Break the date into it's components -- year, month, day
    Check the day vs month for the proper number of days. Check the month for illegal value. Check 2nd month vs year for leapyear.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advancing day by day until it matches a second date
    By nhubred in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2009, 08:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. more date validation
    By bazzano in forum C Programming
    Replies: 5
    Last Post: 08-07-2005, 07:14 AM
  4. DATE <TIME.H> data validation
    By bazzano in forum C Programming
    Replies: 4
    Last Post: 08-07-2005, 01:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21