1. Home
  2. Knowledge Base
  3. Power Automate
  4. Number of months between two date fields | PowerAutomate
  1. Home
  2. Knowledge Base
  3. Microsoft
  4. SharePoint
  5. Number of months between two date fields | PowerAutomate

Number of months between two date fields | PowerAutomate

Unfortunately, there is no Datediff function in PowerAutomate, so here is our solution to calculate the number of months between two dates.

Our data:

Date 1 = Current date, here we use the current date
Date 2 = A date field from SharePoint with the name Contract start

Jahresunterschied herausfinden

Mit folgender Formel finden wir den Jahresunterschied heraus:
sub(int(formatDateTime(body('Aktuelle_Zeit'), 'yyyy')), int(formatDateTime(outputs('Projektinfos_abrufen')?['body/Vertragsbeginn'], 'yyyy')))

Calculate delta of months

sub(int(formatDateTime(body('Aktuelle_Zeit'), 'MM')), int(formatDateTime(outputs('Projektinfos_abrufen')?['body/Vertragsbeginn'], 'MM')))

Combining the year difference and the months

add(mul(outputs('Delta_der_Jahre'), 12), outputs('Delta_der_Monate'))

Dieser Beitrag ist auch verfügbar auf: Deutsch (German)

Was this article helpful?

Related Articles

Submit a Comment

Your email address will not be published. Required fields are marked *

Published on - 3. Nov 2020
Modified on - 1. Apr 2024
Views - 31
Likes - 0

Tags

    Do you need help?

    Kontaktiere uns gerne :-)
    Contact Support