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.
- 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
1 Answer
Reset to default 0You 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条)