web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Dates intervals in con...
Power Automate
Unanswered

Dates intervals in conditionned flows

(0) ShareShare
ReportReport
Posted on by

Hello

I have to dates, DATE IN  and DATE OUT. I want to have a condition on the interval between these 2 dates, for example 100 days between them. How can i do that please underneath?

Thanks.

 

PowerAutomate.png

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @Patgat 

     

    If you looking for difference between the  two dates in days then use the formatDateTime expression

     

    Add a compose for the Date In value and use the expression 

     

    formatDateTime('DateIn', 'yyyyMMdd')

     

    Declare another compose for the same for Date Out

     

    Finally add another compose to subtract the compose output of Date Out - Date In

     

    This will give you the number of days.

     

    Basically convert both dates in yyyyMMdd format and subtract the values.

     

    Thanks

     

     

  • CU06021540-0 Profile Picture
    on at

     

    Thanks very much.

    Could you juste give a screen shot example because the way to use these blocks is a litle bit confusing to me? I don't understand this way to discribe as for instance "Message", "Join" etc.. just to compute the differences between 2 dates.

     

  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @Patgat 

     

    Here it is. In my example below my data source is SharePoint and I have two dates Start Date and End Date.

     

    image.png

     

     

    The compose expression are as follows:

     

    Compose3:

    formatDateTime(items('Apply_to_each')?['EndDate'],'yyyy-MM-dd')
     
    Compose2:
    formatDateTime(items('Apply_to_each')?['StartDate'],'yyyy-MM-dd')
     
    Compose
    sub(outputs('Compose_3'),outputs('Compose_2'))
     
    Thanks

     

  • CU06021540-0 Profile Picture
    on at

     

    It is much clearer thank you a lot.

    But i got an error perhaps because of my syntax =>

     

    At my fist COMPOSE (or MESSAGE in french), i suppose i have a problem with my fiel "DATE ENTREEE". I tried to put a "_"  and a " " in the formula for this field name but i get an error.

    formatDateTime(items('Appliquer_à_chacun')?['DATE_ENTREEE'],'dd-mm-yyyy')
    The error says I don't give a string but a null value for the 1rst parameter of FormatDateTime function...
     
    PowerAutomate.png
     
    PowerAutomate2.png
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @Patgat 

     

    Are these Date in and out values mandatory? Looks like it is returning no values. Check your flow run history.

     

    Thanks

  • CU06021540-0 Profile Picture
    on at

    All these dates are mandatory and fullfiled as shown underneath.

    I have questions about syntax.

    1 - If the field name is "DATE ENTREE", do I hav to code ['DATE_ENTREEE'] or ['DATE ENTREE']? Note that I tried both and nothing changed.

    2- what is the difference between formatDateTime(items and formatDateTime(item

    3- Do I have to write myself  the formula => formatDateTime(items('Appliquer_à_chacun')?['DATE_ENTREEE'],'dd-mm-yyyy') => or do I have to use Dynamic Content for the params in black?

     

    PowerAutomate.png

     

  • CU06021540-0 Profile Picture
    on at

    @abm 

     

    The problem was indeed because of my Field has a space, and in the compose block I need to write 'DATE_X0020_ENTREE' for my 'DATE ENTREE' column... don't know why. As you can see I can see the dates in the 2 first compose Blocks.

    But at the third block, the sub is KO. A message says that thoses dates are strings and not numbers.

    Don't understand where i'm wrong.

    Can you help?

    PowerAutomate2.png

     

     

    PowerAutomate.png

     

  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @Patgat

     

    Make sure you are using a Compose action for this. Also the format of the expression is  yyyyMMdd

     

    Thanks

  • CU06021540-0 Profile Picture
    on at

    Hi @abm 

    Yes it is a compose action block, which is "MESSAGE" action block in French.

    I changed the format of the date as yyyyMMdd but the result is the same for my sub function  =>

    sub(outputs('Message_2'),outputs('Message_1'))
     
    PowerAutomate2.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 711

#2
Vish WR Profile Picture

Vish WR 691

#3
Haque Profile Picture

Haque 525

Last 30 days Overall leaderboard