codetoad.com
  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)
strYr=strYear
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)
}
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
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)
{
dt.focus()
return false
alert("Invalid");
}
else
{
alert("Valid");
}
return true
}

</script>

Please let me know if you have any doubts.

Regards,
Valli


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

Thanks.....

  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=http://mytomshoes.net/goods-2-2011-New-Arrival-Toms-AO8-Canvas-Shoes-for-Lovers.html]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=http://bestashshoesoutlet.com/goods-2-Ash-Birdy-Low-Wedge-White-Leather-Trainer.html]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=http://vanshoesonline.com/goods-2-Vans-Women-s-Ferris-Lo.html]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=http://tbshoeonline.com/goods-2-Tory-Burch-White-Tory-Navy-Foundation-Tote.html]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=http://fiveshoesonline.com/goods-2-Vibram-Five-Fingers-KSO-Black-Grey.html]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=http://www.golfbargainsale.com/discount-TaylorMade-Burner-2-0-Irons-sale-1130.html]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=http://www.golfbargainsale.com/discount-TaylorMade-RBZ-Irons-sale-1231.html]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 http://www.golfbargainsale.com/discount-Taylormade-R9-Forged-Irons-sale-1125.html 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.


<Added>

The Ping G20 Series
The <a href="http://www.golfchainshop.com/Ping-G20-Irons-cheap-price_233.html">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 http://www.golfchainshop.com/Ping-G20-driver-cheap-price_212.html 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="http://www.golfchainshop.com/Ping-G20-Fairway-Woods-cheap-price_222.html">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="http://www.supratksocietyshoesoutlet.com/">Online Supra Sneaker Outlet</a>, Factory Direct!You will find that low price and top quality <a href="http://www.supratksocietyshoesoutlet.com/">Supra Footwear cheap sale</a> for people to choose from. Get best service by every purchase of Supra Footwear. <a href="http://www.supratksocietyshoesoutlet.com/">www.supratksocietyshoesoutlet.com</a> has the latest information about <a href="http://www.supratksocietyshoesoutlet.com/">Justin Bieber Shoes</a>. More information about <a href="http://www.supratksocietyshoesoutlet.com/">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="http://www.supratksocietyshoesoutlet.com/">Supra Footwear</a>,<a href="http://www.supratksocietyshoesoutlet.com">Supra Shoes UK</a> and more!Top quality <a href="http://www.supratksocietyshoesoutlet.com/">Supra Society Mid Shoes</a> are hot sale now,welcome to our <a href="http://www.supratksocietyshoesoutlet.com/">Supra Shoes Store</a> the more surprise waitting for your such as high quality,fast shipping and 46% OFF!
<p>This <a href="http://www.supratksocietyshoesoutlet.com/men-supra-society-mid-shoes-c-15/">Men Supra Society Mid Shoes</a> is the most fashion style this season.The <a href="http://www.supratksocietyshoesoutlet.com/">supra store</a> is a good choose,and became a bright point for this Supra Shoe.<a href="http://www.supratksocietyshoesoutlet.com/men-supra-skytop-shoes-c-4/">Men Supra Skytop Shoes Discount</a>,We stock various <a href="http://www.supratksocietyshoesoutlet.com/">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="http://www.supratksocietyshoesoutlet.com/">Supra Skytop</a>.All shoes are packaged with original tags,fast mailing to your door.Welcome to choose one!</p>
<p>Best <a href="http://www.supratksocietyshoesoutlet.com/">Supra shoes online</a> retailer here!Many fashion justin bieber shoes just design for you.High quality <a href="http://www.supratksocietyshoesoutlet.com/kid-supra-skytop-shoes-c-11/">discount Kid Supra Skytop Shoes Sale Online</a> at low prices.</p>
<p><a href="http://www.supratksocietyshoesoutlet.com/2012-new-supra-tk-society-c-2/">2012 New Supra TK Society</a>
<a href="http://www.supratksocietyshoesoutlet.com/justin-bieber-shoes-c-1/">Justin Bieber Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/men-supra-skytop-shoes-c-4/">Men Supra Skytop Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/men-supra-skytop-iii-shoes-c-7/">Men Supra Skytop III Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/men-supra-tk-society-shoes-c-3/">Men Supra TK Society Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/men-supra-vaider-shoes-c-9/">Men Supra Vaider Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/women-supra-skytop-shoes-c-6/">Women Supra Skytop Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/women-supra-skytop-iii-shoes-c-8/">Women Supra Skytop III Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/women-supra-tk-society-shoes-c-5/">Women Supra TK Society Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/women-supra-vaider-shoes-c-10/">Women Supra Vaider Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/kid-supra-skytop-shoes-c-11/">Kid Supra Skytop Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/kid-supra-tk-society-c-12/">Kid Supra TK Society</a>
<a href="http://www.supratksocietyshoesoutlet.com/supra-pilot-shoes-c-13/">Supra Pilot Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/supra-cuttler-ns-shoes-c-14/"></a>
<a href="http://www.supratksocietyshoesoutlet.com/men-supra-society-mid-shoes-c-15/">Men Supra Society Mid Shoes</a>
<a href="http://www.supratksocietyshoesoutlet.com/women-supra-society-mid-shoes-c-16/">Women Supra Society Mid Shoes</a>
<p><a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-black-grey-orange-shoes-p391.html">2012 Supra Skytop Black Grey Orange Shoes</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-black-grey-purple-shoes-p392.html">2012 Supra Skytop Black Grey Purple Shoes</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-black-red-sneaker-p393.html">2012 Supra Skytop Black Red Sneaker</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-black-white-green-black-p394.html">2012 Supra Skytop Black White Green Black</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-black-white-snowflake-shoes-p395.html">2012 Supra Skytop Black White Snowflake Shoes</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-blue-snowflake-shoes-p396.html">2012 Supra Skytop Blue Snowflake Shoes</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-grey-black-snowflake-shoes-p397.html">2012 Supra Skytop Grey Black Snowflake Shoes</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-grey-snowflake-shoes-p398.html">2012 Supra Skytop Grey Snowflake Shoes</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-white-black-snowflake-shoes-p399.html">2012 Supra Skytop White Black Snowflake Shoes</a> <a href="http://www.supratksocietyshoesoutlet.com/2012-supra-skytop-white-orange-snowflake-shoes-p400.html">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 codetoad.com 2001-2014