cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DCI19
Level: Powered On

Change Time Picker from 24hr to 12hr

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Change Time Picker from 24hr to 12hr

@DCI19 

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

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Change Time Picker from 24hr to 12hr

@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
Level: Powered On

Re: Change Time Picker from 24hr to 12hr

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
Level: Powered On

Re: Change Time Picker from 24hr to 12hr

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

 

Bid Date 1.PNGBid Date 2.PNG

Super User
Super User

Re: Change Time Picker from 24hr to 12hr

@DCI19 

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

View solution in original post

DCI19
Level: Powered On

Re: Change Time Picker from 24hr to 12hr

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

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,475)