Subtracting days from a date in javascript -
i have 2 <input type="text">
tags , enter dates in them 22-05-2013
i want subtract 22-06-2012
date
how do this?
i've tried code didn't work:
function returndate(ndays){ var = new date(); var dayoftheweek = now.getday(); now.settime(now.gettime() - ndays * 24 * 60 * 60 * 1000); alert(now); // returns current date alert(now.getfullyear() + "/"+(now.getmonth()+1)+"/"+now.getdate()) // returns new calculated date }
so need difference between 22-05-2013
, 22-06-2012
the best way use moment.js. has fantastic support dates.
Comments
Post a Comment