Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 19th, 2008, 12:07 AM
Authorized User
 
Join Date: Jul 2008
Location: , , India.
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default Date difference

Hi,

How to find the diffence between two dates in javascript. my input date format is like 19-Sep-2008.

Thanks in advance.

 
Old September 19th, 2008, 12:27 AM
Authorized User
 
Join Date: Jul 2008
Location: , , India.
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default

i got the result. here is the code

function compareDates(date1,date2)
    {
    var dateformat = 'dd-MMM-yyyy';
    var d1=getDateFromFormat(date1,dateformat);
    var d2=getDateFromFormat(date2,dateformat);
    if (d1==0 || d2==0) {
        return -1;
        }
    else if (d1 > d2) {
        return 1;
        }
    return 0;
    }

 
Old September 19th, 2008, 12:42 AM
Authorized User
 
Join Date: Jul 2008
Location: , , India.
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default

here is the link. get the full code from there.

http://www.mattkruse.com/javascript/date/index.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
get date difference benz_jie2005 Access 1 January 16th, 2008 09:33 AM
Date Difference Help saf01 Crystal Reports 0 September 29th, 2005 05:35 AM
Difference between Date and Now() marcin2k Access VBA 3 September 8th, 2005 01:05 PM
Date difference. rupen Classic ASP Basics 6 July 21st, 2005 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.