473,387 Members | 1,771 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,387 software developers and data experts.

Date Validiation

I have a textbox which requires to fill out date in the format mm/dd/yyyy
I want to know how i custom my validiator to check if input is in right
format

Thanks
Nov 18 '05 #1
5 1387
I would use a RegularExpressionValidator to ensure the date was entered in properly. For the "ValidationExpression" property you'll have to write your own regular expression to ensure the date entered is in the exact format you want, but here's a good site for understanding regular expressions. http://www.regxlib.com

Hope this helps
Jeremy
Nov 18 '05 #2
Use a regular expression validator. If you aren't familiar with writing
regular expressions, you can look at samples of regular expressions for
dates here:

http://www.regxlib.com/DisplayPatter...4&categoryId=5
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Hai Nguyen" <ha******@neo.tamu.edu> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have a textbox which requires to fill out date in the format mm/dd/yyyy
I want to know how i custom my validiator to check if input is in right
format

Thanks

Nov 18 '05 #3
Geez, the existing feature's so hidden that even MVPs don't know about it.
(Sorry Chris, wanted to make a point to MS. This is the third time this
question was posted in this newsgroup in the last 2 days.)

The CompareValidator can validate the date format. Set Operator to
DataTypeCheck and Type to Date.

FYI: A much better way to handle date entry is to use one of the many date
textboxes with popup calendars offered out there. Mine is "Peter's Date
Package" (http://www.peterblum.com/datecontrols/home.aspx) and includes
validators.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com

"Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
news:uz**************@TK2MSFTNGP11.phx.gbl...
Use a regular expression validator. If you aren't familiar with writing
regular expressions, you can look at samples of regular expressions for
dates here:

http://www.regxlib.com/DisplayPatter...4&categoryId=5
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Hai Nguyen" <ha******@neo.tamu.edu> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have a textbox which requires to fill out date in the format mm/dd/yyyy I want to know how i custom my validiator to check if input is in right
format

Thanks


Nov 18 '05 #4

"Peter Blum" <PL****@Blum.info> wrote in message
news:u2**************@TK2MSFTNGP11.phx.gbl...
Geez, the existing feature's so hidden that even MVPs don't know about it.
(Sorry Chris, wanted to make a point to MS. This is the third time this
question was posted in this newsgroup in the last 2 days.)

The CompareValidator can validate the date format. Set Operator to
DataTypeCheck and Type to Date.


What format does this validator use? Or in other words, if the user
types in "2-1-2004" would that be read as "2-jan-2004" or "feb-1-2004"?

I know about this validator, but as that format is not clear, I don't use
it.

Hans Kesting
Nov 18 '05 #5
The validator uses the current Culture to determine the format. Look at the
CultureInfo object in the .net docs for its DateTimeFormat property. It uses
the ShortDatePattern.

Each page has a default Culture, defined in the web.config under
globalization or in the <@ Page Culture= > tag.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ub**************@TK2MSFTNGP11.phx.gbl...

"Peter Blum" <PL****@Blum.info> wrote in message
news:u2**************@TK2MSFTNGP11.phx.gbl...
Geez, the existing feature's so hidden that even MVPs don't know about it. (Sorry Chris, wanted to make a point to MS. This is the third time this
question was posted in this newsgroup in the last 2 days.)

The CompareValidator can validate the date format. Set Operator to
DataTypeCheck and Type to Date.


What format does this validator use? Or in other words, if the user
types in "2-1-2004" would that be read as "2-jan-2004" or "feb-1-2004"?

I know about this validator, but as that format is not clear, I don't use
it.

Hans Kesting

Nov 18 '05 #6

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

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
9
by: Thomas R. Hummel | last post by:
Hello, I am importing data that lists rates for particular coverages for a particular period of time. Unfortunately, the data source isn't very clean. I've come up with some rules that I think...
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...
3
by: captain | last post by:
Below is the sql for data with same date need to extract + or - 5 days data of same date also. How to also get data of + and - days related to same date. SELECT IM.Area, IM.Location,...
3
by: Hai Nguyen | last post by:
I wonder if there is a way we can make user select dropdownlist box before they can go to the next page I did use validiation control but seem it fail
0
by: Douglas Gage | last post by:
Hi every one I'm building datagrid which needs to have validiation check for each text box. Something will look like this Question Answer 1 abc validiation...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.