Skip to main content

Notifications

Copilot Studio - General
Answered

Formula to check if an input date is within 48 hours

Like (1) ShareShare
ReportReport
Posted on 4 Oct 2024 11:07:15 by 34
I am asking the user to input the date of their session using the prebuilt date entity and saving as a variable called Topic.session_date
 
I am then trying to create a metho din which I can check if session date is within 2 days of today's date.
I have tried creating a new variable called within_48 and used the following formula to output a true or false value but it failed:
Formula: =IF((TODAY() - Topic.session_date) <= 2, TRUE, FALSE)
 
I also tried using a condition of if Topic.session_date is Today() AND Today() - 1 AND Today() -2 
 
but neither has worked.
Categories:
  • Verified answer
    JE-09091517-0 Profile Picture
    JE-09091517-0 34 on 04 Oct 2024 at 15:00:36
    Formula to check if an input date is within 48 hours
    Figured it out, Posting here for anyone else who needs it!
     
    If(
        Abs(DateDiff(Today(), Topic.session_date, TimeUnit.Days)) <= 2,
       True
       False
    )
     
     
  • Suggested answer
    Vinoth Selvam Profile Picture
    Vinoth Selvam 1,289 on 04 Oct 2024 at 13:51:53
    Formula to check if an input date is within 48 hours
    Hello,
     
    Can you try using the below expression.
     
    If(
    Abs(DateValue(Topic.Session_date) - Today()) <= 2,
    "Date is within 2 days of today.",
    "Date is not within 2 days of today."
    )
     
     
    Kindly update the variables accordingly.
     
    Thanks.
     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,238

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,290

Leaderboard
Loading started