Skip to main content
Community site session details

Community site session details

Session Id : TrWNVmQdM5wiw4YgZTE2Jp
Power Apps - Building Power Apps
Answered

Default hour to now if form mode new but don’t change if edit

Like (0) ShareShare
ReportReport
Posted on 8 Nov 2023 22:07:11 by 7

Hi,

 

I have a power app form linked to SharePoint list. One of the cards Is a date and time picker.

 

i have managed to set the date to current date if the form is new but use parent default if editing.

 

what I would like to achieve is to set the hour and mins to current time if the form is in new mode, however if the form is in edit I would just like the previously selected values to remain.

 

time format would need to be 24 hour.

 

 

  • Verified answer
    gcmfaizan Profile Picture
    1,022 on 09 Nov 2023 at 13:48:41
    Re: Default hour to now if form mode new but don’t change if edit

    @Jimbobrich 
    On DatePicker DefaultDate use this:

    If(
     Form1.Mode = FormMode.New,
     DateTimeValue(Text(Today(), "yyyy-mm-dd")),
     Parent.Default
    )

    On Hours Dropdown Default property use:

    If(
     Form1.Mode = FormMode.New,
     Hour(Now()),
     Text(Hour(Parent.Default),"00")
    ) 

    and On Minitues Dropdown Default property use:

    If(
     Form1.Mode = FormMode.New,
     Minute(Now()),
     Text(Minute(Parent.Default),"00")
    ) 

     

     

    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

     

    Thanks!

  • Jimbobrich Profile Picture
    7 on 09 Nov 2023 at 13:36:38
    Re: Default hour to now if form mode new but don’t change if edit

     

    Hi,

     

    Sorry, I'm still learning with powerapps, should the formula be entered in the default on the data card?

     

    I dont seem to be able to get any solution to work, obviously this is user error on my behalf. 

     

    data.JPG

     

  • gcmfaizan Profile Picture
    1,022 on 09 Nov 2023 at 12:05:03
    Re: Default hour to now if form mode new but don’t change if edit

    @Jimbobrich ,

    can you try this:

    If(
     FormMode() = FormMode.New,
     DateTimeValue(Text(Today(), "yyyy-mm-dd") & " " & Text(Now(), "[$-en]HH:mm")),
     Parent.Default
    )

     

    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

     

    Thanks!

  • Jimbobrich Profile Picture
    7 on 09 Nov 2023 at 11:42:25
    Re: Default hour to now if form mode new but don’t change if edit

    Hi @SpongYe 

     

    I have tried the above but this hasn't had the desired impact. When I create now or edit I just get a blank value.

     

    I have used the above formula on the date and it has worked perfectly, obviously changing Now() for Today().

     

    I'm at a loss of how to resolve this. 

  • SpongYe Profile Picture
    5,580 Super User 2025 Season 2 on 08 Nov 2023 at 22:15:19
    Re: Default hour to now if form mode new but don’t change if edit

    Hi @Jimbobrich 

     

    In the formula bar of the Time Picker, set the Default to:

    If(
     FormName.Mode = FormMode.New, // replace FormName with the name of your form
     Now(), 
     Parent.Default
    )

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete