Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every one,

I am developing an application in Flash Builder 4.6 and in my Application I have TextInput field to get the date from user. I wanna get it in this format: yyyy/mm/dd like 2013/09/24
So, what should be my regular expression to check if a correct date in the above format is submitted or not??
my textinput field id is "date"

And I am getting its value in my actionscript function like this:

var d_date:String = new String;
d_date = date.text.toString();

Now I wanna check this d_date if it is in yyyy/mm/dd format?
Any suggestions??
Thanks for any help...
Posted

1 solution

The best suggestion I can give is: don't use a regex for this.
By all means use a basic regex to check four-digits-slash-two-digits-slash-two-digits; thats simple:
^\d{4}/\d\d/\d\d$
But do not try to take it any further. It really isn't worth it: check and convert the actual date in code, it is a lot, lot simpler!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900