Date validation

  • Thread starter Thread starter Peter Afonin
  • Start date Start date
P

Peter Afonin

Hello,

Can anyone recommend me a regular expression that could validate any date
format, including military - dd-MMM-yyyy, i.e. 1-Mar-2007. I've found many
datetime validation expressions, but not for this format.

Thank you,
 
Hi

here's a sample that works partialy

\d{1,2}\-[A-Za-z]{3}\-\d{4}

or if you want to be more specific

\d{1,2}\-[Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec]\-\d{4}

Adlai

--
-------------------------------------
If my answer helped you please press "Yes" bellow

×× ×ª×©×•×‘×” זו עזרה לך, ×× × ×”×¦×‘×¢ "כן"

Adlai Maschiach
http://blogs.microsoft.co.il/blogs/adlaim/
 
Thank you for all your suggestions.

Peter

Hi,

You can try microsoft ajax control library and can use mask edit for date
plz referhttp://ajax.asp.net/ajaxtoolkit/MaskedEdit/MaskedEdit.aspx

Cheers
Chetan Chaphekar







- Show quoted text -
 
Hello,

Can anyone recommend me a regular expression that could validate any date
format, including military - dd-MMM-yyyy, i.e. 1-Mar-2007. I've found many
datetime validation expressions, but not for this format.

Thank you,

Hey Peter,

If you want to validate *ANY* date format I would advise before resorting
to wrestling with the many many regular expressions (since there are many
many valid date formats) first of all try to minimize the need to validate
dates by using controls that are aware of dates ... like calendars or date
pickers. This way you minimize code and effort and make it easier for users
to input data
 
Back
Top