web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details
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.

 

 

I have the same question (0)
  • 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!

Helpful resources

Quick Links

Responsible AI policies

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete