Date validation

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,
 
G

Guest

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/
 
P

Peter Afonin

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 -
 
R

Rad [Visual C# MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,222
Latest member
patricajohnson51

Latest Threads

Top