Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
Can someone give me a hand with this Excel formula, in order to convert it to JAVASCRIPT: =((DAY((DATE(YEAR(A1),1+MONTH(A1),1)-1))-(DAY(A1)))/(DAY((DATE(YEAR(A1),1+MONTH(A1),1)-2))))+(DATEDIF(A1,B1,"m")-1)+((DAY(B1))/(DAY(DATE(YEAR(B1),1+MONTH(B1),1)-1)))

to JAVASCRIPT?

Thanks,
Chris
Posted
Updated 6-Jan-14 2:30am
v2

 
Share this answer
 
Thank you for the fast answer, but is not what I was looking for.
I have found out something that is closer to what I'm searching for, but this code gives the answer in months and days:
Calculate Age / Duration Between Two Dates using JavaScript[^]

I need a code that will calculate the difference between two dates in months.

For example the difference in months between 20.JUNE.13 - 15.MAY.14, is equal to 0,36666 (19 days from June)+ JUL+ AUG+ SEP+ OCT+ NOV+ DEC+ JAN+ FEB+ MAR+ APR+ 0.48387 (15 days from MAY) = 10.85053 months.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900