Date Format Validation

Discussion in 'iPhone/iPad Programming' started by ilx.mac, Nov 5, 2009.

  1. macrumors member

    Joined:
    Mar 10, 2009
    #1
    Hi There,

    I have a text field, where the user can enter date & press submit button. I need to validate the user entered text to the date format (MM/dd/yyyy). Is there a way to get that?

    Add Info: The user may also enter alpha-numeric ex: 12/we-3f in date text field. Also is there a way to restrict user to enter numeric along with special character '/'.

    I must not use date picker!

    Thanks in Advance!
     
  2. macrumors member

    Joined:
    Jul 2, 2009
    #2
    What does 12/we-3f mean?

    Also remember that much of the world outside the US uses dd/mm/yyyy. Are you going to have you app available outside the US?

    If you just stick to mm/dd/yyyy then validation is simple. Make sure it's in the required format, split the string up and validate each field separately. The most complex field is the dd but even then you just have an array of days in the month (and of course you allow for leap years).
     

Share This Page