cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
UC3378
Helper III
Helper III

Change 24 Hr format to 12 Hr Format

I am connected to a sharepoint calendar from powerapps.  How do you change the 24 hour format from powerapps to 12 hr format in the input and edit forms?  Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @UC3378 ,

You have to add it to the card on the right of the others (you will need to unlock the card)  - that is the first item I put in.

Also note that the code will need to be altered to your control names.

 

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.

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @UC3378 ,

Add another drop down at the right with Items

["AM", "PM"]

and the Default

If(Hour(Parent.Default) < 12, "AM", "PM")

The Items of the Hour control

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

and the Default

Text(If(Mod(Hour(Parent.Default), 12) = 0, 12, Mod(Hour(Parent.Default), 12)),"00")

Now the Update of the Data Card

DateControlName.SelectedDate + 
Time(
   If(
      AmPmControlName.Selected.Value = "PM", 
      12, 
      0
   ) + 
   Mod(
      Value(
         HourControlName.Selected.Value
      ), 
      12
   ), 
   Value(
      MinuteControlName.Selected.Value
   ),
   0
)

NOTE - you will need to replace the control names above with yours.

 

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.

@WarrenBelz ,

 

Thanks for your reply.  I tried working on it today but didnt really get a chance to finish it. I will give it a shot again tomorrow.  But one thing i did notice was that my start time data card does not include an AM/PM, so how will that translate to the sharepoint calendar?  

Hi @UC3378 ,

You have to add it to the card on the right of the others (you will need to unlock the card)  - that is the first item I put in.

Also note that the code will need to be altered to your control names.

 

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.

View solution in original post

@WarrenBelz ,

 

Thanks that worked, you are a genius!

 

I have a related issue hope you can help as well.  When I click on a particular day in the calendar, it pops up an edit form and it loads whatever event that is in that day that I want to modify.  The event along with its date and time is loaded correctly on the edit form.  But if I edit the start date and time only and not touch the end date and time at all, or visa versa, it goes out of funk.  So it will update only the start date and time, but will not update the end date and time, it will leave it blank.  And if I go back into the edit form, the end date and time is reset.  Back in sharepoint, it deletes that event altogether.  Have you seen this?  Thanks.

 

cal1.PNG

cal2.PNG

 

 

 

Hi @UC3378 ,

Happy to help with this, but I will be offline shortly.

This should be another subject, can you please accept this one and tag me on the new one. Please add some screen shots so ai can understand the issue a bit better.

 

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.

I'm not sure why you are using the Mod() function here. 

 

If I just use 12 for the Hour default and

 

DateValue.SelectedDate + Time(
If(
AMPM.Selected.Value = "PM",
12,
0
) + Value(Hour.Selected.Value),
Value(Minute.Selected.Value),
0
)

 

for the "Update" on the card it gives me the correct Time value.

I started down this path and stumbled on your solution.  I like it.  I'm running a test today and accepted your solution.  I was close. 

Thankyou @WarrenBelz this worked perfectly for me!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,046)