Call Flow App - Get Yesterday's Date

Status
Not open for further replies.

Compton IT

Customer
Joined
Feb 1, 2024
Messages
3
Reaction score
1
So, I can use NOW to get today, but I can't find an easy way to get yesterdays date, any suggestions?
 
DateTime.Now.AddDays(-1)

Quick Google search would've told you.
 
  • Like
Reactions: edossantos
So, I can use NOW to get today, but I can't find an easy way to get yesterdays date, any suggestions?
For anyone else who finds this. The answer is that you'll have to use an Execute C# Code component to do it. For whatever reason you can natively call DateTime.Now, but nothing else to do with DateTime. Call Flow Apps are just C# code as well...

I ended up with the below block of code inside the C# Code component;
C#:
DateTime searchdate = DateTime.Now;
if(searchdate.Hour < 9){
    searchdate = searchdate.AddDays(-1);
}
return searchdate.ToString("yyyy-MM-dd");
 
  • Like
Reactions: Evolute IT
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,285
Messages
591,704
Members
165,406
Latest member
ARKC