SURESHKUMAR.NET FORUMS
Registered Member Login:
Not a member? Register today!



Welcome to the SURESHKUMAR.NET FORUMS.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.




Ask for Suggestion Need any suggestions while choosing a career or other ? Post them here. We would like to help you.

How to compare dates in javascript?

        

Reply
 
LinkBack Thread Tools Display Modes
Old 07-02-07, 12:53 PM   #1 (permalink)
Junior Member
 
Join Date: Feb 2007
Age: 25
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 balasri1984 is on a distinguished road
Question How to compare dates in javascript?

hi ,
i need to validate and check two date fields startdate and enddate so that the enddate must be greater than the startdate in javascript.
can any one help me ?

bala

balasri1984 is offline Offline   Reply With Quote
Old 07-02-07, 01:06 PM   #2 (permalink)
Moderator
 
kiran2710's Avatar
 
Join Date: Jul 2006
Posts: 2,190
Thanks: 5
Thanked 547 Times in 335 Posts
Rep Power: 77 kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute kiran2710 has a reputation beyond repute
Re: doubt in javascript (urgent)

Check dis link, hope u vil get answer.........

Performing Form Validation with Validation Controls > Comparing Values: The CompareValidator Control
__________________



Kiran







kiran2710 is offline Offline   Reply With Quote
The Following User Says Thank You to kiran2710 For This Useful Post:
AjayKumar.Kataram (17-02-09)
Old 07-02-07, 02:05 PM   #3 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Posts: 2,376
Blog Entries: 4
Thanks: 118
Thanked 326 Times in 238 Posts
Rep Power: 62 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
Re: doubt in javascript (urgent)

function getDateObject(dateString,dateSeperator)
{
//This function return a date object after accepting
//a date string ans dateseparator as arguments
var curValue=dateString;
var sepChar=dateSeperator;
var curPos=0;
var cDate,cMonth,cYear;

//extract day portion
curPos=dateString.indexOf(sepChar);
cDate=dateString.substring(0,curPos);

//extract month portion
endPos=dateString.indexOf(sepChar,curPos+1); cMonth=dateString.substring(curPos+1,endPos);

//extract year portion
curPos=endPos;
endPos=curPos+5;
cYear=curValue.substring(curPos+1,endPos);

//Create Date Object
dtObject=new Date(cYear,cMonth,cDate);
return dtObject;
}
var startDate = getDateObject(document.groupForm.Date.value,"/");
var endDate = getDateObject(document.groupForm.endDate.value,"/");[FONT=verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif]
[/FONT]if(startDate < endDate)
alert("startDate is less than endDate");
if(startDate >= endDate)
alert("startDate is greater than or equal to endDate");
sk_kireeti is offline Offline   Reply With Quote
The Following User Says Thank You to sk_kireeti For This Useful Post:
AjayKumar.Kataram (17-02-09)
Old 07-02-07, 06:53 PM   #4 (permalink)
Junior Member
 
Join Date: Feb 2007
Age: 25
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 balasri1984 is on a distinguished road
Re: doubt in javascript (urgent)

thank u ......
balasri1984 is offline Offline   Reply With Quote
Old 17-02-09, 12:10 AM   #5 (permalink)
Senior Member
 
Join Date: Aug 2006
Location: Hyderabad,India
Age: 31
Posts: 8,035
Thanks: 2,100
Thanked 459 Times in 316 Posts
Rep Power: 127 AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute AjayKumar.Kataram has a reputation beyond repute
Re: How to compare dates in javascript?

thanks
AjayKumar.Kataram is offline Offline   Reply With Quote
Old 12-01-10, 05:50 PM   #6 (permalink)
Junior Member
 
mnreddy's Avatar
 
Join Date: Jan 2007
Location: Hyderabad
Age: 31
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 mnreddy is on a distinguished road
Re: How to compare dates in javascript?

Thank u very much for this script
mnreddy is offline Offline   Reply With Quote
Reply

Tags
compare , dates , javascript


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mega Free Download S/W Links A-Z yathish OTHERS 516 21-03-09 10:06 AM
Openings for JAVASCRIPT MASTERS in Intrasoft Technologies santhu Fresher Jobs 0 20-12-06 07:49 PM
Compare Infobase Pvt.Ltd.: HTML Programmer sridhar Fresher Jobs 2 23-08-06 01:28 AM
JavaScript Qs Set - 1 vjsreevs WEB DESIGNING, DEVELOPMENT ,PROMOTION & SEO 4 07-08-06 09:20 PM
JAVASCRIPT INSECURITIES wizkid SYSTEM SECURITY & ETHICAL HACKING 0 29-07-06 02:31 PM


All times are GMT +6.5. The time now is 07:57 AM.

More Interview Questions Here...

Content Relevant URLs by vBSEO 3.3.2