1
People want to have the difference of months between two dates. However I’m missing something. I want to enter the dates in the inputs and the result appear in another input.
var DateDiff = {
inMonths: function(d1, d2) {
var d1Y = d1.getFullYear();
var d2Y = d2.getFullYear();
var d1M = d1.getMonth();
var d2M = d2.getMonth();
return (d2M+12*d2Y)-(d1M+12*d1Y);
}}
var dataInicio= document.getElementById("dataInicio");
var dataFinal = document.getElementById("dataFinal");
document.write("<br />Numero de <b>months</b> since "+dataInicio+": "+DateDiff.inMonths(dataInicio, dataFinal));
Do you have any examples? I adptei this because I don’t know javascript. You can help me?
– Ramon Chaves
I didn’t even see it was javascript malz ae... peri
– MagicHat
http://answall.com/questions/13046/diferen%C3%A7a-entre-datas do @Bacco
– MagicHat
i did, ae ...?
– MagicHat
Not yet. I tried to follow the example didn’t work. :(
– Ramon Chaves
peri, tho see something here
– MagicHat
Tabom. I’ll wait. Thanks for your help.
– Ramon Chaves
@ Magichat nothing. As soon as you find me let me know.
– Ramon Chaves