@equals(items('Apply_to_each')?['Start_x0020_Date'], addDays(utcnow('yyyy-MM-dd'), -7))
Start Date = 30/08/2017
Anyone any ideas about evaulating dates?
If i email the variables through when this is not equal i get...
2017-08-30T09:42:29.5176527Z 2017-08-30
Thanks,
Gaz
Solved! Go to Solution.
hi @Gazzaluty
The best way in my vision is transform dates to ticks and compare then
in this case your condiction should be:
@equals(ticks(items('Apply_to_each')?['Start_x0020_Date']), ticks(addDays(utcnow(), -7)))
OBS: if you need to compare only date without values you may transform the date before, removing the time value, like this:
@equals(ticks(concat(formatDateTime(triggerBody()?['Start_x0020_Date'], 'yyyy-MM-dd'), 'T00:00:00Z')), ticks(concat(formatDateTime(addDays(utcnow(), -7), 'yyyy-MM-dd'), 'T00:00:00Z')))
if you have questions about the functions you can put one per one in a compose to see the result.
Hope this help.
Best Regards,
Gustavo Moraes
Gustavo Moraes, o astronauta brasileiro do Flow!
Hi @Gazzaluty,
As suggested by @gamoraes, when comparing date string, we should first format both of the date string into a same format:
@equals(formatDateTime(triggerBody()?['Start_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(addDays(utcnow(), -7), 'yyyy-MM-dd') )
Doing it in this way should make it work, if the condition is focus on date.
Regards,
Michael
hi @Gazzaluty
The best way in my vision is transform dates to ticks and compare then
in this case your condiction should be:
@equals(ticks(items('Apply_to_each')?['Start_x0020_Date']), ticks(addDays(utcnow(), -7)))
OBS: if you need to compare only date without values you may transform the date before, removing the time value, like this:
@equals(ticks(concat(formatDateTime(triggerBody()?['Start_x0020_Date'], 'yyyy-MM-dd'), 'T00:00:00Z')), ticks(concat(formatDateTime(addDays(utcnow(), -7), 'yyyy-MM-dd'), 'T00:00:00Z')))
if you have questions about the functions you can put one per one in a compose to see the result.
Hope this help.
Best Regards,
Gustavo Moraes
Gustavo Moraes, o astronauta brasileiro do Flow!
Hi @Gazzaluty,
As suggested by @gamoraes, when comparing date string, we should first format both of the date string into a same format:
@equals(formatDateTime(triggerBody()?['Start_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(addDays(utcnow(), -7), 'yyyy-MM-dd') )
Doing it in this way should make it work, if the condition is focus on date.
Regards,
Michael
This method doesn't seem to work with me.
I have an excel table with a column for dates. I'm trying to see if the dates in that column are in next week.
But I keep getting an error when I use the below exression
@lessOrEquals(ticks(items('Apply_to_each')?['Date']), ticks(addDays(utcnow(), 7)))
Below is the screenshot of the error.
Hey Wasup?
I think you forgot to put 'FormatDateTime'
@lessOrEquals(ticks(formatDateTime(items('Apply_to_each')?['Date'])), ticks(addDays(utcnow(), 7)))
Gustavo Moraes, o astronauta brasileiro do Flow!
It shows the same error even when I do that.
It looks like an issue with excel.
yes im having the same problem, can anyone help please?
thanks,
Ibrahim
Yes. Excel formats dates as numbers whereas flow expects it to come through in a string format.
Has anyone found a workaround?
This solution seems to be working for me. But I used it with "equals to" condition. I'm not sure if it works with other logic's.
User | Count |
---|---|
98 | |
40 | |
27 | |
23 | |
16 |
User | Count |
---|---|
130 | |
52 | |
48 | |
36 | |
24 |