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 / Change Time Picker fro...
Power Apps
Answered

Change Time Picker from 24hr to 12hr

(0) ShareShare
ReportReport
Posted on by 37

How do i change the date and time picker from 24-hr to 12-hr format.

 

This is what is already in the data card:

DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)

 

I located a previous solution, when I enter this it does not work:

 

AmPmValue1.Items: ["AM", "PM"]
AmPmValue1.Default: If(Hour(Parent.Default) < 12, "AM", "PM")
HourValue1.Items: ["12","01","02","03","04","05","06","07","08","09","10","11"]
HourValue1.Default: Text(If(Mod(Hour(Parent.Default), 12) = 0, 12, Mod(Hour(Parent.Default), 12)),"00")
DataCard1.Update: DateValue1.SelectedDate + Time(If(AmPmValue1.Selected.Value = "PM", 12, 0) + Mod(Value(HourValue1.Selected.Value), 12), Value(MinuteValue1.Selected.Value), 0)

 

This link that references a formula doesn't tell you how to insert to change: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-clock-calendar

 

 

Please help!

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @DCI19 

    I have copied and pasted the code you supplied into a test app and everything works fine for me.   Your post says your code does not work.  Could you please tell me what specifically does not work with your code?

  • Marqiux Profile Picture
    54 on at

    Hello, 
    Where in the card does this code get pasted into?
    Is it when the card is selected? the one that includes the hrs and minutes?

    DataField?
    Default? 

  • DCI19 Profile Picture
    37 on at

    When I insert the code it shows error, see screen shots.

     

    Bid Date 1.PNGBid Date 2.PNG

  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @DCI19 

    All of the code does not get pasted in a single control.  You need to put the code in each control/property.

  • DCI19 Profile Picture
    37 on at

    Ah, thank you. Once you mentioned it needed to be broken down I was able to make adjustments successfully.

  • DCI19 Profile Picture
    37 on at

    hello @mdevaney ,

     

    I am just now catching and issue. I separated the update like you previously mentioned, but now when PM is selected it automatically changes to AM once you submit. Why isn't the PM working?

     

     

  • mdevaney Profile Picture
    29,989 Moderator on at

    @DCI19 

    Your last post on this thread was over a month ago.  I suggest you create a new thread and explain the problem you are now having there instead.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • kmsdove Profile Picture
    60 on at

    Yes there are separate areas to place the code (Default, Item and Update).  To get mine to work I had to lose the 0 in from to the numbers 1-9.   There is a post on here that breaks it down as to where the pieces are placed. 

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard