A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] RegExp for date YYYY-MM-DD

  1. #1
    Member
    Join Date
    Apr 2001
    Location
    Cape Town
    Posts
    99

    resolved [RESOLVED] RegExp for date YYYY-MM-DD

    Hi all,

    I am building a application that stores data on MySQL database. Since the column make use of the date format YYYY-MM-DD I must ensure that the user provides the correct format. I am currently using a RegExp with the format MM/DD/YYYY that I got off the Internet.

    var dateExpression : RegExp =/^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d$/;

    However I do not understand the syntax of the expression to modify it to my needs. Can somebody please shed some light, please!

    Many thanks.

  2. #2
    Member
    Join Date
    Apr 2001
    Location
    Cape Town
    Posts
    99
    I figured it out after finding this very helpful site:

    http://coursesweb.net/actionscript/r...s-actionscript

    So the correct syntax:

    var dateExpression : RegExp =/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center