cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MH3
Post Prodigy
Post Prodigy

Time Picker AM/PM Hour and Minute

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


2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

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.

View solution in original post

@MH3 ,

What is the error on? Can you please pull this apart until it runs and identify which piece of code is causing the issue.
Also you might try this

Reset(RequestDate_DataCard1_2);
If(
   RemForm.Mode=FormMode.Edit,
   Patch(
      'Travel Request',
      {ID:ReqGal.Selected.ID},
      ReqFrom.Updates,
      InfoForm.Updates,
      TripForm.Updates,
      PrefForm.Updates,
      RemForm.Updates
   ), 
   Patch(
      'Travel Request',
      Defaults('Travel Request'),
      ReqFrom.Updates,
      InfoForm.Updates,
      TripForm.Updates,
      PrefForm.Updates,
      RemForm.Updates
   )
)

 

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

21 REPLIES 21
WarrenBelz
Super User
Super User

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.

View solution in original post

v-siky-msft
Community Support
Community Support

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

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? 

Hi @MH3 ,

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

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

 

Hi @MH3 ,

Try

If(
  YourFormName.Mode = FormMode.New,
  Now(),
  ThisItem.RequestDate
)

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?

HI @MH3 ,

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

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?

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,216)