Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-22-2007, 08:51 PM   PM User | #1
PHPycho
Regular Coder

 
Join Date: Dec 2005
Posts: 217
Thanks: 1
Thanked 0 Times in 0 Posts
PHPycho has a little shameless behaviour in the past
JS date range validation ??

I have two date field viz from-date and to-date
and i want to validate that from-date should be less than or equal to to-date
using javascript.
Note: date field should be in yy-mm-dd format
How is that possible ?
Please help me..
Thanks in advance..
PHPycho is offline   Reply With Quote
Old 02-22-2007, 09:22 PM   PM User | #2
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,887
Thanks: 5
Thanked 186 Times in 183 Posts
Arbitrator is on a distinguished road
You can split the date into pieces then compare them part by part. It’ll be harder if you want to compare 1900 years with 2000 years in a yy format though.
Code:
var fromDateSplit = fromDate.split("-");
var toDateSplit = toDate.split("-");
Tutorial: http://www.pageresource.com/jscript/jstring2.htm*
* Uses some poor practice and outdated code.
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *
Arbitrator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:14 AM.


Advertisement
Log in to turn off these ads.