web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : yT6ow9j9M/pUAlKRFA86Rl
Power Apps - Building Power Apps
Answered

Add additional time to a date and time already displayed

Like (1) ShareShare
ReportReport
Posted on 11 Jul 2024 14:49:51 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

I have the same question (0)
  • PPDEV Profile Picture
    126 on 11 Jul 2024 at 15:48:30
    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!

  • Dave-ITMan Profile Picture
    on 11 Jul 2024 at 16:25:17
    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

  • Verified answer
    PPDEV Profile Picture
    126 on 11 Jul 2024 at 23:34:57
    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 12 Jul 2024 at 08:52:25
    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

  • Dave-ITMan Profile Picture
    on 12 Jul 2024 at 12:47:40
    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 752 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 472

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 358 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete