Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hola buenos días,
Estoy realizando un ciclo for y no he logrado encontrar la forma para calcular la cantidad de meses entre dos fechas y esta me pueda generar qvds independientes.
Agradezco su ayuda.
Hi @Jose_ ,
Here's two ways you can calculate the number of months.
You can calculate the number of days between the dates and get a decimal value of the period.
(((Date2 - Date1)*12)/365.25)
or
You can round the months and calculate the differences between them.
(year(Date2)+(month(Date2)*12))-(year(Date1)+(month(Date1)*12))
This is how the monthdiff() function works in the "R" program
You can try both options and see which might suit your needs.
Regards
Anthony
Hi @Jose_ ,
Here's two ways you can calculate the number of months.
You can calculate the number of days between the dates and get a decimal value of the period.
(((Date2 - Date1)*12)/365.25)
or
You can round the months and calculate the differences between them.
(year(Date2)+(month(Date2)*12))-(year(Date1)+(month(Date1)*12))
This is how the monthdiff() function works in the "R" program
You can try both options and see which might suit your needs.
Regards
Anthony
thank you very much i will check it