Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Add additional time to a date and time already displayed

(1) ShareShare
ReportReport
Posted on by

Hi Experts,

 

I have an app with 7x TextInput fields. One of them displays the date and time now (as below)

TextInputTime
Text(Now(),"[$-en-GB]dd/mm/yyyy hh:mm:ss","en-GB")

 

The other 6x fields will have the below shown in them.

TextInput1
3 days

 

TextInput2
1 day

 

TextInput3

8 hours

 

TextInput4
5 hours

 

TextInput5
2 hours

 

TextInput6
30 minutes

 

What i'm wanting to do is add the timing displayed in TextInput1 - TextInput6 based on the selection of a dropdown made previously to the TextInputTime field by doing something like:

If('Dropdown-Impact'.Selected.Value = "Nobody Affected", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Only Affecting One Person", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Affecting Group of People", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Affecting a Department", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Affecting Entire Business", TextInputTime.Text
)

 

Please help, thanks in advance

Dave

  • Dave-ITMan Profile Picture
    on at
    Re: Add additional time to a date and time already displayed

    Hi @ppDev_30 ,

     

    I've managed to sort my issues by amending the code as per the below:

    "Nobody Affected", DateAdd (Text(Now(), "[$-en-GB]dd/mm/yyyy hh:mm:ss","en-GB"), Value(Left(NobodyAffectedRespSLA.Text, 1)), Mid(NobodyAffectedRespSLA.Text, Find(" ", NobodyAffectedRespSLA.Text) + 1)),

     

    Thanks again for your help

     

    Regards

    Dave

  • Dave-ITMan Profile Picture
    on at
    Re: Add additional time to a date and time already displayed

    Hi @ppDev_30 ,

     

    This has worked perfectly thank you. The only issue that I have is that the date is showing in American format, do you know how I can adjust the code to change it to UK format please DD/MM/YYYY? 

     

    Currently showing as

    DaveITMan_0-1720774326641.png

     

     

    Thanks again

    Dave

  • Verified answer
    PPDEV Profile Picture
    83 on at
    Re: Add additional time to a date and time already displayed

    Hi @Dave-ITMan, please try this switch condition code

     

     

     

    Switch(
     ddType.Selected.Value,
     "Nobody Affected", DateAdd(Now(), Value(Left(Label1.Text, 1)), Mid(Label1.Text, Find(" ", Label1.Text) + 1)),
     "Only Affecting One Person", DateAdd(Now(), Value(Left(Label1_1.Text, 1)), Mid(Label1_1.Text, Find(" ", Label1_1.Text) + 1)),
     "Affecting Group of People", DateAdd(Now(), Value(Left(Label1_2.Text, 1)), Mid(Label1_2.Text, Find(" ", Label1_2.Text) + 1)),
     "Affecting a Department", DateAdd(Now(), Value(Left(Label1_3.Text, 1)), Mid(Label1_3.Text, Find(" ", Label1_3.Text) + 1)),
     "Affecting Entire Business", DateAdd(Now(), Value(Left(Label1_4.Text, 2)), Mid(Label1_4.Text, Find(" ", Label1_4.Text) + 1))
    )

     

     

     

     

    This code finds the value you wanted to add in the date

     

     

     

    Value(Left(Label1.Text, 1))

     

     

     

     

    While this code will find the time units you wanted to use (Days, Hours, Minutes)

     

     

     

    Mid(Label1.Text, Find(" ", Label1.Text) + 1)

     

     

     

     

    I have tested it on my end and it works, I've included screen for your reference.

    12.07.2024_07.44.15_REC.gif

     

     

     

    Hope this helps!

  • Dave-ITMan Profile Picture
    on at
    Re: Add additional time to a date and time already displayed

    Hi @ppDev_30 ,

     

    Thanks for the reply. That is saying that .Days isn't recognized which I think is because the original date in TextInputTime has been converted to text in order to display correctly in UK time as it keeps pulling through American time. 

     

    Regards

    Dave

  • PPDEV Profile Picture
    83 on at
    Re: Add additional time to a date and time already displayed

    Hi @Dave-ITMan, I think the easiest way to do achieve your requirement is by using DateAdd native function of Power Apps.

     

    You can try the following code to test and try to experiment that will align to your requirements:
     DateAdd( Now(), 3, TimeUnits.Days )

    Hope this helps!

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard