473,748 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1406
I would use a RegularExpressi onValidator to ensure the date was entered in properly. For the "ValidationExpr ession" 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.t amu.edu> wrote in message
news:%2******** ********@TK2MSF TNGP10.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 CompareValidato r 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****@PeterBlu m.com

"Chris Jackson" <chrisjATmvpsDO TorgNOSPAM> wrote in message
news:uz******** ******@TK2MSFTN GP11.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.t amu.edu> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.in fo> wrote in message
news:u2******** ******@TK2MSFTN GP11.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 CompareValidato r 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 ShortDatePatter n.

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****@PeterBlu m.com

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

"Peter Blum" <PL****@Blum.in fo> wrote in message
news:u2******** ******@TK2MSFTN GP11.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 CompareValidato r 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
5218
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 appreciated. TIA
4
5390
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 calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
2
4181
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 why it doesn't work? Thanks in advance Tjerk
9
2633
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 will work to clean the data, but I'm having trouble putting those rules into efficient SQL. The table that I'm dealing with has just under 9M rows and I may need to use similar logic on an even larger table, so I'd like something that can be made...
30
3691
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 seems unnecessarily long. For some while, the following approach has been given here :- function ValidDate(y, m, d) { // m = 0..11 ; y m d integers, y!=0
3
2571
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, IT.itemid, IT.date,
3
1103
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
975
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 check 2 345 validiation check 3 def validiation check 4 52 validiation check 5 cgh validiation check
12
29467
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 follows: function doDateCheckNow(source, args) { var oDate = document.getElementById(source.controltovalidate); // dd/mm/yyyy
0
8822
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9528
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9359
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9310
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9236
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8235
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.