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

12 pm in am pm value

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)

I have been using this formula but when i try to put in 12 pm it turns the time into Am. 

What should I do ? 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: 12 pm in am pm value

@mehul_sompura 

I'm not experiencing the same issue.  I took your formula and your setup and was able to get the results properly. 

I took an edit form connected to a SharePoint list with a Date and Time (specifically - a Date Column that includes Time)

I added a AmPmValue1 dropdown control to the datacard and altered all the properties as you have exactly (copy and paste).  Upon submit, the proper 12AM and 12PM as entered on the form appeared in the SharePoint list.

The ONLY difference is that you reference a MinuteValue1 control.  I actually had changed my MinuteValue to the AmPmValue1 control...so I altered the Time calculation and made the Value(MinuteValue1.Selected.Value) to 0.

I am doubting that the MinuteValue control could be impacting anything, but perhaps you can change your formula to:  

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

And see if there is any difference (just so we are comparing apples-to-apples) as this was the only control properties that you did not mention in your orignal post.

If still nothing...then change your formula to this as a test:

DateValue1.SelectedDate + Time(12, 0, 0)

This *should* give you 12 PM in the SharePoint list and will test any issue with the data source.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: 12 pm in am pm value

@mehul_sompura 

Formula looks good at a glance...

Question is - what is your datasource and, is it showing up as 12 AM or as another AM time?  If it is showing up in the data as another AM time, then you are most likely dealing with a TimeZoneOffset issue.  In that case you will want to change your Update formula to convert to UTC.  Then make sure you use the formula to convert back when using the value in the column you store.

 

I hope that is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
mehul_sompura
Level: Powered On

Re: 12 pm in am pm value

my data source is a sharpoint list. it shows up as 12 am and i have two time field. start and end. So, if i put my strart time as 12pm it turns it to 12 am and even the end time turnsinto Am instead of pm.

Super User
Super User

Re: 12 pm in am pm value

@mehul_sompura 

I'm not experiencing the same issue.  I took your formula and your setup and was able to get the results properly. 

I took an edit form connected to a SharePoint list with a Date and Time (specifically - a Date Column that includes Time)

I added a AmPmValue1 dropdown control to the datacard and altered all the properties as you have exactly (copy and paste).  Upon submit, the proper 12AM and 12PM as entered on the form appeared in the SharePoint list.

The ONLY difference is that you reference a MinuteValue1 control.  I actually had changed my MinuteValue to the AmPmValue1 control...so I altered the Time calculation and made the Value(MinuteValue1.Selected.Value) to 0.

I am doubting that the MinuteValue control could be impacting anything, but perhaps you can change your formula to:  

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

And see if there is any difference (just so we are comparing apples-to-apples) as this was the only control properties that you did not mention in your orignal post.

If still nothing...then change your formula to this as a test:

DateValue1.SelectedDate + Time(12, 0, 0)

This *should* give you 12 PM in the SharePoint list and will test any issue with the data source.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

mehul_sompura
Level: Powered On

Re: 12 pm in am pm value

thanks.

Super User
Super User

Re: 12 pm in am pm value

@mehul_sompura 

What was the issue??  Did you resolve it?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
mehul_sompura
Level: Powered On

Re: 12 pm in am pm value

There was a problem in my update screen of my powerapps. Got it solved now.

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 145 members 4,869 guests
Recent signins:
Please welcome our newest community members: