How to create a condition in Power Automate that compares a ShortDate field from Excel with today's date? - Stack Overfl

I am importing a ShortDate field from Excel called Date into PowerAutomate. I want to create a conditio

I am importing a ShortDate field from Excel called Date into PowerAutomate. I want to create a condition that compares Date to the current date. I cannot get it to work. Today is March 25, 2025, which Excel stores as 45741

"Date" "is equal to" "45741" (with quotes) evaluates to True.

"Date" "is equal to" 45741 (without quotes) evaluates to False.

"Date" "is equal to" utcNow() evaluates to False.

"Date" "is equal to" utcNow('yyyy-MM-dd') evaluates to False.

What is the correct syntax to compare Date with the current day? It looks like it's looking for a string?

UPDATE: I added a new column to my Excel table called "DateYYYYMMDD" and set it to =TEXT([@Date], "YYYYMMDD"), which changes the value of the date to e.g. "202503125" (without quotes). I then had PowerAutomate compare that field to the value of utcNow('yyyyMMdd'), and this works successfully. Is there a way to do this TEXT() call in PowerAutomate itself? I would like to not have to create that extra table column in Excel, if possible.

I am importing a ShortDate field from Excel called Date into PowerAutomate. I want to create a condition that compares Date to the current date. I cannot get it to work. Today is March 25, 2025, which Excel stores as 45741

"Date" "is equal to" "45741" (with quotes) evaluates to True.

"Date" "is equal to" 45741 (without quotes) evaluates to False.

"Date" "is equal to" utcNow() evaluates to False.

"Date" "is equal to" utcNow('yyyy-MM-dd') evaluates to False.

What is the correct syntax to compare Date with the current day? It looks like it's looking for a string?

UPDATE: I added a new column to my Excel table called "DateYYYYMMDD" and set it to =TEXT([@Date], "YYYYMMDD"), which changes the value of the date to e.g. "202503125" (without quotes). I then had PowerAutomate compare that field to the value of utcNow('yyyyMMdd'), and this works successfully. Is there a way to do this TEXT() call in PowerAutomate itself? I would like to not have to create that extra table column in Excel, if possible.

Share Improve this question edited Mar 26 at 13:22 MrSnrub asked Mar 25 at 20:03 MrSnrubMrSnrub 4754 silver badges15 bronze badges 1
  • How are you retrieving the data from Excel? If it’s via the standard connector then I’m pretty sure there’s an option in the action to provide the dates in a friendly format, and yes, dates in PowerAutomate are compared as strings. – Skin Commented Mar 25 at 21:22
Add a comment  | 

1 Answer 1

Reset to default 0

You just need to convert your date integer to a valid date before you can perform any other operations. A simple way is to add that number of days to lowest date (1899-12-30). Please note int() is optional - just in case your sheet is returning the number as string.

addDays('1899-12-30', int(45741)) 

The above will return the date like this "2025-03-25T00:00:00.0000000"

Once converted, you can use formatDateTime to convert it to any desired annotation/format and use for comparisons.

You can achieve the whole thing to get yyyyMMdd in a single go like this

formatDateTime(addDays('1899-12-30',int(45741)), 'yyyyMMdd')

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744171493a4561557.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信