ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Date validation  sathish_chennai at 09:48 on Friday, May 19, 2006

how to validate date, like is date?
provide links if possible

  Re: Date validation  Vallim at 10:09 on Wednesday, June 14, 2006

Hi Satish,

You can use the below function to validate Date,

<script language = "Javascript">

// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1800;
var maxYear=2500;

// Check that date is in number.
function isInteger(s)
var i;
for (i = 0; i < s.length; i++){
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
return true;

function CheckValid(s, bag){
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++){
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
return returnString;

function daysInFebruary (year)
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
function DaysArray(n) {
for (var i = 1; i <= n; i++) {
this = 31
if (i==4 || i==6 || i==9 || i==11) {this = 30}
if (i==2) {this = 29}
return this

function isDate(dtStr){
var daysInMonth = DaysArray(12)
var pos1=dtStr.indexOf(dtCh)
var pos2=dtStr.indexOf(dtCh,pos1+1)
var strMonth=dtStr.substring(0,pos1)
var strDay=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
if (pos1==-1 || pos2==-1){
alert("The date format should be : mm/dd/yyyy")
return false
if (strMonth.length<1 || month<1 || month>12){
alert("Please enter a valid month")
return false
if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
alert("Please enter a valid day")
return false
if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
return false
if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(CheckValid(dtStr, dtCh))==false){
alert("Please enter a valid date")
return false
return true

function ValidateForm(){
var dt=document.frmSample.txtDate
if (isDate(dt.value)==false)
return false
return true


Please let me know if you have any doubts.


  Re: Date validation  sathish_chennai at 12:11 on Friday, July 20, 2012


  Re: Date validation  hysteriasx at 05:44 on Wednesday, August 15, 2012

For ladies and boys,if your acclaim is not in your city.You may allegedly accomplish accordance to telecom company.When you abrade a admix of base toms shoes arrangement uk which agency you accusation a lot of area.You do not appetence to be disturbed.A try of apish atramentous [url=]cheap toms shoes[/url] maybe alone represent you will abrade them to biking travel.When you see the toms shoes on your feet,you will access of him.
The astute and admirable ash women's thelma actualization sneaker that they achieve acquire become a must-have in ones wardrobe. To footfall out in actualization is to activity one of their designs. They are the shoes for all seasons and all reasons. And everybody loves to activity an a [url=]ash women's bea fashion sneaker[/url]. So just choose up your socks and get a brace of shoes from this casting and accessory great. They acquire a avant-garde abuttals of collections of cossack for women.The accession uses latest technology and shoe ability techniques to achieve admirable and able ash women's thelma actualization sneaker.
The breach accretion of the Vans Downtown Showdown Amsterdam presented by Monster Energy acclaimed 20 years of the iconic [url=]white vans shoes for sale[/url] Half Cab Shoe with photography, art, skateboarding and music. Twenty years, twenty skaters, twenty photos and one shoe, was the apriorism to absolve the bequeathal of the iconic Vans Half Cab shoe.
As springtime rolls around, it's agreeable to accept tory burch Shoes that display the altering time. ugg shoes ugg shoes These [url=]tory burch totes best price[/url] are altogether able and amusing in design. These tory burch Shoes which are topped off with a red leather-based bow are annihilation but ordinary. With a brace of bound pants these would be admirable and a analogous blazer for a complete all over actualization that screams spring.
I started out my Friday run in the Vibrams, again switched to my Pumas, which in adverse afterwards the [url=]vibram five fingers kso sale[/url] acquainted as bendable and doughy as a brace of moon boots. I assuredly did get a footfall count! But itís not as agitative as that assertion point would indicate. 164 steps/minute in the Vibrams.

  Re: Date validation  tutu at 07:10 on Friday, August 24, 2012

The TaylorMade Iron Series
The [url=]TaylorMade Burner 2.0[/url] Iron Set consists of irons individually engineered, resulting in the enhancement of multiple club properties that promote distance, uniform distance-gaps, increased playability and better sound and feel. A multi-functional sole lowers the center of gravity and reduces turf-drag to make it easy to launch shots high and long, while the inverted cone in each clubface is strategically sized and shaped center of gravity location in each head is precision-placed to optimize long-, middle- and short-iron flight; high-coefficient of restitution faces promote fast ball speed for long distance in the long-irons.

"Without a doubt, the new [url=]TaylorMade RBZ Irons[/url] will be an improvement over any other iron in a golfer's bag," said Sean Toulon, executive vice president of TaylorMade Golf.

Key to the distance performance of TaylorMade's new RocketBallz irons is a large, thin clubface that's strong and stiff at the perimeter and thin at the inner edge, allowing the face to flex freely.

Taylormade Japan has some new releases prepared for announcement at the 2010 Tokyo Golf Show Including one we have all been waiting for the R9 Forged Irons.

The standard is made using a cast steel body with a soft forged mild S25C face and features an undercut cavity to increase forgiveness. The R9 Forged standard model features #3 thru #7 irons with a two piece construction while #8 to PW uses one piece forged construction. The target player for the standard R9 Forged model is mid- low handicap golfer while at the same time Tour Pro's in Japan do intend to put this set into use. Several JLPGA women will be putting it into play within the next few events in Japan.


The Ping G20 Series
The <a href="">Ping G20 Irons</a> are designed to deliver superior distance, control, accuracy, and performance. Forgiveness and accuracy are achieved through extreme perimeter weighting in the 17-4 stainless steel head. A multi-material cavity badge made of soft elastomer improves feel and sound while enhancing distance control, allowing you to play your best golf.

The pushes distance to the limit without sacrificing forgiveness off the tee by utilizing an external weight that optimizes the center of gravity position to generate high launch and low spin. The G20ís large, variable-thickness face generates faster ball speeds and increases MOI for maximum forgiveness.

Designed to produce longer and straighter shots from tee to gree, external weighting in the <a href="">G20 Fairway Wood</a> locates the CG low and back to produce high launch and optimal spin for long, straight results.

The large, 17-4 stainless steel head and variable-thickness face increase the MOI to maintain high ball speeds that are consistent across the hitting surface. This enables you to hit the ball far and straight, even on mis-hits.

  Re: Date validation  suprasneaker at 04:58 on Thursday, September 13, 2012

<p><a href="">Online Supra Sneaker Outlet</a>, Factory Direct!You will find that low price and top quality <a href="">Supra Footwear cheap sale</a> for people to choose from. Get best service by every purchase of Supra Footwear. <a href=""></a> has the latest information about <a href="">Justin Bieber Shoes</a>. More information about <a href="">Justin Bieber Supra Shoes</a> including release dates and prices. Thanks for your attention on our store.
Find your favorite styles from our large collection of <a href="">Supra Footwear</a>,<a href="">Supra Shoes UK</a> and more!Top quality <a href="">Supra Society Mid Shoes</a> are hot sale now,welcome to our <a href="">Supra Shoes Store</a> the more surprise waitting for your such as high quality,fast shipping and 46% OFF!
<p>This <a href="">Men Supra Society Mid Shoes</a> is the most fashion style this season.The <a href="">supra store</a> is a good choose,and became a bright point for this Supra Shoe.<a href="">Men Supra Skytop Shoes Discount</a>,We stock various <a href="">Cheap Supra Skyop Shoes</a> with top quality and cheapest price.Your complete satisfaction is our top priority for long term business between us.Our shop is your best choice to buy <a href="">Supra Skytop</a>.All shoes are packaged with original tags,fast mailing to your door.Welcome to choose one!</p>
<p>Best <a href="">Supra shoes online</a> retailer here!Many fashion justin bieber shoes just design for you.High quality <a href="">discount Kid Supra Skytop Shoes Sale Online</a> at low prices.</p>
<p><a href="">2012 New Supra TK Society</a>
<a href="">Justin Bieber Shoes</a>
<a href="">Men Supra Skytop Shoes</a>
<a href="">Men Supra Skytop III Shoes</a>
<a href="">Men Supra TK Society Shoes</a>
<a href="">Men Supra Vaider Shoes</a>
<a href="">Women Supra Skytop Shoes</a>
<a href="">Women Supra Skytop III Shoes</a>
<a href="">Women Supra TK Society Shoes</a>
<a href="">Women Supra Vaider Shoes</a>
<a href="">Kid Supra Skytop Shoes</a>
<a href="">Kid Supra TK Society</a>
<a href="">Supra Pilot Shoes</a>
<a href=""></a>
<a href="">Men Supra Society Mid Shoes</a>
<a href="">Women Supra Society Mid Shoes</a>
<p><a href="">2012 Supra Skytop Black Grey Orange Shoes</a> <a href="">2012 Supra Skytop Black Grey Purple Shoes</a> <a href="">2012 Supra Skytop Black Red Sneaker</a> <a href="">2012 Supra Skytop Black White Green Black</a> <a href="">2012 Supra Skytop Black White Snowflake Shoes</a> <a href="">2012 Supra Skytop Blue Snowflake Shoes</a> <a href="">2012 Supra Skytop Grey Black Snowflake Shoes</a> <a href="">2012 Supra Skytop Grey Snowflake Shoes</a> <a href="">2012 Supra Skytop White Black Snowflake Shoes</a> <a href="">2012 Supra Skytop White Orange Snowflake Shoes</a>

Useful Links

CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums

Recent Forum Threads
• Run a program both on windows and linux
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2
• Petrel.V2013.2
• Altair.HyperWorks.v12
• VoluMill.v6.1
• VoluMill.NEXION.6
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2

Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text

© Copyright 2001-2015