Hi!

This is my code to get the difference of two dates in Javascript.

var today = new Date();

            var dd = today.getDate();

            var mm = today.getMonth()+1; //January is 0!

            var yyyy = today.getFullYear();



            if (dd < 10)

            {

                dd='0'+dd

            } 

            if (mm < 10)

            {

                mm='0'+mm

            } 



            today = mm+'/'+dd+'/'+yyyy;

            var minutes = 1000*60;

            var hours = minutes*60;

            var days = hours*24;


            var foo_date1 = getDateFromFormat(today, "M/d/y");

            var foo_date2 = getDateFromFormat("02/28/2015", "M/d/y");



            var diff_date = Math.round((foo_date2 - foo_date1)/days);

            var ans = Math.abs(diff_date);

            alert(ans);

This works fine in my localhost. However, when I upload it to the server. It does not work anymore.
When I use IE, this is the error it founds.

34288f738c65501d5c6e5c4ca5623554

I tried to chmod the file permissions for all the javascripts and jquery it needs even the folder that these javascript is contained. But it does not do anything.

Kindly help me please :((

well, i just changed my code, since it seems that it does not recognize the getDateFromFormat() syntax.

here is the revised one.

var minutes = 1000*60;

    var hours = minutes*60;

    var days = hours*24;

    var date1 = new Date(today);

    var date2 = new Date("02/28/2015");

    var timediff = date2 - date1;

    var ans = Math.floor(timediff / days);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.