473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Date validation

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,

--
Peter Afonin
Mar 6 '07 #1
4 4798
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/
"Peter Afonin" wrote:
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,

--
Peter Afonin
Mar 6 '07 #2
Hi,

You can try microsoft ajax control library and can use mask edit for date
plz refer
http://ajax.asp.net/ajaxtoolkit/Mask...askedEdit.aspx

Cheers
Chetan Chaphekar

"Peter Afonin" wrote:
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,

--
Peter Afonin
Mar 6 '07 #3
Thank you for all your suggestions.

Peter

On Mar 6, 3:01 am, Chetan Chaphekar
<ChetanChaphe...@discussions.microsoft.comwrote:
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

"PeterAfonin" wrote:
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,
--
PeterAfonin- Hide quoted text -

- Show quoted text -

Mar 6 '07 #4
On Mon, 5 Mar 2007 19:12:45 -0800, Peter Afonin wrote:
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

--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
0
by: Brian Conway | last post by:
I am having some validation and insertion problems. I am using a date picker that takes the selected date and puts it to ("dd-MMM-yyyy") format, as this was the only format that Oracle would...
7
by: Paul | last post by:
Hi, I have a form where a user is required to enter a start date and an end date. Both are required and must between a specific date range (e.g. 01/01/1900 and 01/01/2099) and the end date...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
12
by: Diego | last post by:
Can I validate (possibly with a compare validator) a Date entered by the user based upon his regional settings? I.e. if a user is american the format would be mm/dd/yyyy, if brittish dd/mm/yyyy...
1
by: Brendan Reynolds | last post by:
In an ASP.NET 1.1 app I have the following range validation control. This is an intranet app that will be used only within Ireland, so all date input is expected to be in dd/mm/yyyy format. ...
17
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
3
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I have VS 2005 (C#) There is a control numericUpDown so you can spin numeric values. What I need to do is to spin date (+- one day). How to do that? Moreover, I want a user to type the date as...
2
by: John Smith | last post by:
Hello, I have a VB.NET application with a Windows form that have several textboxes fields where I have dates entered. I would like to do a date validation check after the the field is updated, so...
5
Stang02GT
by: Stang02GT | last post by:
I have been asked to validate a date on our web-page so that people cannot enter dates like 14/1/08 or 2/30/06. I have found code that will do exactly what i need it to do, but i am not sure how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.