Click here to Skip to main content
15,916,318 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
javascript validation:

validate the format of the Date as MM/DD/YYYY,
Has to be a real date and that it is equal to or earlier than the current date.
If the validation fails the following error message will be shown
Invalid Date. Only number and forward slash (/) characters are allowed. The valid format is MM/DD/YYYY.


Please help me with the code.
Posted
Updated 4-Mar-13 6:07am
v2
Comments
[no name] 4-Mar-13 12:08pm    
Please post the code that you have written and describe how it does not perform as you expect.... ASAP.
Sandeep Mewara 4-Mar-13 13:06pm    
It does not work like this here.

Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it's not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.

1 solution

check this link , it will help you to get many ideas :
system.datetime.date
and you can use this codes in c# too .:
C#
DateTime dt = DateTime.Parse("02/22/2012");//you can put a textbox.text instead this date
if (dt.ToString("mm/dd/yyyy") == dt.GetDateTimeFormats()[3])// an if statement check if format is mm/dd/yyyy
    MessageBox.Show(dt.ToString());
else
    MessageBox.Show(dt.ToString("Invalid Date. Only number and forward slash (/) characters are allowed. The valid format is MM/DD/YYYY."));
 
Share this answer
 
v3

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