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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Date logic not working...
Power Automate
Answered

Date logic not working with my workflow

(0) ShareShare
ReportReport
Posted on by 57

Hi All,

@ManishSolankiand Community helpers,

 

I am new to Power Automate and I am stuck with a problem here where I want to compare a simple date from an excel with now

 

riti17_0-1706525815250.png

 

This is my sample data source

 

1) Part 1 is fine where Feedback = N

2) But as you can see today is 29th of Jan and date over there is 30th of jan

riti17_1-1706525975731.png

 

riti17_2-1706526059251.png

 

riti17_0-1706526256656.png

 

 

 

 

Regards,

Ritesh

 

 
 

 

 

 

 

 

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,441 Super User 2025 Season 2 on at

    Have you set the DateTime Format in the Excel connector to ISO-8601?

    Chriddle_0-1706528453073.png

    If so, can you show the values in the flow run that were compared?

    Are you aware that utcNow('yyyy-MM-dd') does not necessarily represent the date in your time zone?

  • riti17 Profile Picture
    57 on at

    hi @Chriddle 

    Thanks for your reply, I am using google sheet connector and I don't see this

    riti17_0-1706590687850.png

    Or, I need to check somewhere else ?

     

    Yes, I am aware and I don't think that is the issue

     

    I have used the date values in the body of the email as below

     

    riti17_1-1706592335911.png

     

    This should fail but it is passing

    riti17_2-1706592482364.png

     

    and I am getting the email when I am not suppose to.

     

    Date formats are different , Is this the reason and how can we sync the format ? I was not able to do that with the formatdatetime function

     

     

    Regards,

    Ritesh

  • Verified answer
    Chriddle Profile Picture
    8,441 Super User 2025 Season 2 on at

    You are right, it's the date format.

    You compare '02/29/2024' with '2024-01-30' and since dates are strings and therefore compared from left to right, the value from the sheet is always smaller.

    Use parseDateTime() to convert to ISO-8601 and formatDateTime() to exclude the time part before comparing to utcNow('yyyy-MM-dd'):

     

     

    formatDateTime(
    	parseDateTime('02/29/2024'),
    	'yyyy-MM-dd'
    )

     

     

    In general it's a good idea to use parseDateTime() if the connector does not provide ISO-8601 formatted datetimes.

     

    However, here, isn't it possible to set the sheet's column type to "Date" and have the connector provide correctly formatted date strings? (I have no experience with Google connectors, but that sounds reasonable to me.)

  • riti17 Profile Picture
    57 on at

    hi @Chriddle 

     

    Your suggestion was quite useful and I am accepting your solution.

     

    I just had one follow-up question on this,

    I tried the date difference now but getting blank in the output,

     

    Date1(working)=

    formatDateTime(
        parseDateTime(items('Foreach')?['Certifcation_x0020_Date']),
        'yyyy-MM-dd'
    )
     
    Date2(working)=
    formatDateTime(utcNow(),'yyyy-MM-dd')
     
    But when I use
    DateDiff=dateDifference(formatDateTime(utcNow(),'yyyy-MM-dd'), formatDateTime(
    parseDateTime(items('Foreach')?['Certifcation_x0020_Date']),
    'yyyy-MM-dd'))
     
    This is not working, perhaps I will raise a new question
     
     

     

    Regards,

    Ritesh

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard