Android Question Edittext Date format

Discussion in 'Android Questions' started by Kiran Raotole, Jul 21, 2018.

  1. Kiran Raotole

    Kiran Raotole Active Member Licensed User

    I have to validate date format for edittext.
    Like dont accept wrong date.
    ex. 50/07/2018 == not accepted or 21/25/2018
  2. Dabzy1978

    Dabzy1978 Member Licensed User

    Regex is your friend...

    The above will return false as obviously, theres no 50th month (See last parameter of Regex.IsMatch), though bang, say 05 in there and you'll get true as expected.

    This also takes leap years into account, as well as other date formats... Check the original source page for more details.

    Original source:

    Last edited: Jul 21, 2018
  3. MarkusR

    MarkusR Well-Known Member Licensed User

    or spilt it by / or - and make three variables day,month,year and check the range.
    if they ok make a new date variable from it.

    or use a date input control.
  4. DonManfred

    DonManfred Expert Licensed User

  5. Kiran Raotole

    Kiran Raotole Active Member Licensed User

    how to use date input control
  6. MarkusR

    MarkusR Well-Known Member Licensed User

  7. Kiran Raotole

    Kiran Raotole Active Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice