Data360 Analyze

 View Only
  • 1.  Calculate the total number of months between two dates

    Posted 01-23-2020 01:52

    Hello,

     

    I want to calculate the total number of months between two dates.

    If I use a  Calculate Fields, I can get the number of days (EndD - StartD).days, but the same principle cannot be used for .months because the timedelta object has not attibute "months". 

    I can get the total number of months using a Transform node (superseded) or get the same result with a calculate field (first I obtain the total days between the dates and divide it by 30).

    Is there a simpler method?

    Thank you 



  • 2.  RE: Calculate the total number of months between two dates

    Employee
    Posted 01-23-2020 06:17

    It depends on what you mean by the number of months - the raw difference (which would be EndD.month - StartD.month if both dates were in the same year) or the number of complete months.

    Here is a community custom node that calculates the number of complete months between the specified dates

     

    Attached files

    Calculate Months Between Dates--share - 18 May 2018.lna