borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (error)Next Topic (xml) New Topic New Poll Post Reply
AndreaVB Forum : ASP.Net : Two date compare by Javascript ?
Poster Message
tri_inn
Level: Wizard

Registered: 26-08-2002
Posts: 383

icon Two date compare by Javascript ?

suppose i have two date 10/02/2004 and 15/05/2004 and now i want to compare this two date
that which one is greater by javascript.how to do it.please provide sample code

16-11-2004 at 07:24 AM
View Profile Send Email to User Show All Posts | Quote Reply
ashish12
Level: Trainee

Registered: 02-06-2005
Posts: 1
icon Re: Two date compare by Javascript ?

quote:
tri_inn wrote:
suppose i have two date 10/02/2004 and 15/05/2004 and now i want to compare this two date
that which one is greater by javascript.how to do it.please provide sample code


















From date
To date  







Free JavaScripts provided

by The JavaScript Source






ashish pandey

____________________________
ashish

02-06-2005 at 06:28 AM
View Profile Send Email to User Show All Posts | Quote Reply
vikrammandal
Level: Trainee

Registered: 11-08-2005
Posts: 2
icon Re: Two date compare by Javascript ?

For those who are facing the same situation, here is a simple solution:

d1 = new Date(2005,12,15);
d2 = new Date(2005,12,25);

if (d1.getTime()   alert('d1 is less than d2');
}


cheers!!!
- Vikram

____________________________
- Vikram

11-08-2005 at 10:48 AM
View Profile Send Email to User Show All Posts | Quote Reply
vikrammandal
Level: Trainee

Registered: 11-08-2005
Posts: 2
icon Re: Two date compare by Javascript ?

Code specific to tri_inn's need could be:

d1_str = '10/02/2004';
d2_str = '15/05/2004';


d1 = new Date(d1_str.split('/')[2],d1_str.split('/')[1],d1_str.split('/')[0]);
d2 = new Date(d2_str.split('/')[2],d2_str.split('/')[1],d2_str.split('/')[0]);

if (d1.getTime()   alert('d1 is less than d2');
}

---
I know the thread is one year old ..but just in case u wanted it.  

____________________________
- Vikram

11-08-2005 at 10:53 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : ASP.Net : Two date compare by Javascript ?
Previous Topic (error)Next Topic (xml) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder