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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Time Picker AM/PM Hour...
Power Apps
Unanswered

Time Picker AM/PM Hour and Minute

(0) ShareShare
ReportReport
Posted on by 1,057

Hello, Everyone

 

I am using SharePoint Data-source and I want to have a Date Picker with Time Hour and Minute along with AM and PM Selector,

so what I did is this:

TimePicker.png

I changed the minute value picker into AM/PM selector, but I need Hour, Minute and AM/PM Auto Selected as per current time

Update Formula: 

DateValue4_2.SelectedDate + Time(If(MinuteValue4_2.Selected.Value = "PM", 12, 0) + Mod(Value(HourValue4_2.Selected.Value), 12), 0, 0)


I need the Minute picker as well and the Hour Minute and AM/PM should auto pick by default as respect to the current time.

Need help for adding minute value.

 

 

Any Help


Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    HI @MH3 ,

    The complete code for 12 hour AM/PM time is on this post of mine. Happy to assist further if you get stuck.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • v-siky-msft Profile Picture
    on at

    Hi @MH3 ,

     

    I suggest you add a new Request Date DataCard in the form and remove the older one, since it's clearer to start from scratch.

    Please try the following steps:

    1. create a Timer, Set Duration:1000, Enable Repeat and Auto start, Disable Auto pause, Set OnTimerStart: Set(VarCurrent,Now())

    2. unlock the data card, add a dropdown in it, rename to AmPmValue1,

    set Items: ["AM","PM"]

    set Default: If(Hour(VarCurrent) < 12, "AM", "PM")

    3. modify property of HourValue:

    Items: ["12","01","02","03","04","05","06","07","08","09","10","11"]

    Default: Text(If(Mod(Hour(VarCurrent), 12) = 0, 12, Mod(Hour(VarCurrent), 12)),"[$-en-US]00")

    4. modify property of MinuteValue:

    Default: Text(Minute(VarCurrent),"[$-en-US]00")

    5. Modify property of data card:

    Update: DateValue1.SelectedDate + Time(If(AmPmValue1.Selected.Value = "PM", 12, 0) + Mod(Value(HourValue1.Selected.Value), 12), Value(MinuteValue1.Selected.Value), 0)

     

    Snipaste_2020-06-16_15-45-45.png

    Hope this helps.

    Sik

  • MH3 Profile Picture
    1,057 on at

    Hello @WarrenBelz ,

     

    I have done what you have said in your post and it's working fine, but I want to set the current time when the user creates a new record and in edit mode it should display the time which I had selected while creating.

     

    can you tell me what will be the code? 

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @MH3 ,

    You can default the date/time to Now().

  • MH3 Profile Picture
    1,057 on at

    Sir @WarrenBelz 

    actually I want to make the Date picker card values to the current by default when creating a new record;

    example: 16/06/2020 01:50 PM  (my Current Time and Date) and when editing the existing record it should display the previous values,

     

    what I have in the default of the card is this:

    Card Default Property:

    ThisItem.RequestDate

     

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @MH3 ,

    Try

    If(
     YourFormName.Mode = FormMode.New,
     Now(),
     ThisItem.RequestDate
    )
  • MH3 Profile Picture
    1,057 on at

    Hi @WarrenBelz 


    I put this code before your code:

    If(ReqFrom.Mode=FormMode.Edit,ThisItem.RequestDate,Now())

     
    what's the difference between yours and this?

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    HI @MH3 ,

    In yours, it would show the current time in View Mode (that is if you ever switch to this)

  • MH3 Profile Picture
    1,057 on at

    Hi @WarrenBelz 

     

    I think it's not working, I have created a record with date and time:
    Detail screen.png

    and when I open the record in Edit it shows this:
    01:38 PM, although I had selected 01:52 PM (which was by default the Current time when I was creating the record).
    edit screen.png

    Any help in this?

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @MH3 ,

    I just did a test my end with my code and it worked perfectly on a new record.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard