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

Date, hour, minute picker current date, hour, and minute

 

The first part of this Text(Hour...) corresponds to a dropdown box to pick the current hour
The 2nd part of all the #'s is to pick the minutes

 

Text(Hour(Parent.Default),"[$-en-US]00")

["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"]


The last part is selecting my date (which will just choose off of the last linked event I choose) 

BrowseGallery1.Selected.EventDate


What I am trying to do, is make the date picker to always show the current date, and have the hour and minute box show the current time, but still allow choosing any number.

image.png

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Date, hour, minute picker current date, hour, and minute

You can change the Default property of the card (the card that holds the value, not the individual controls) so that if the value is null (which is the case for new items) then it will use the current time instead.

Coalesce(ThisItem.<dateTimeFieldName>, Now())

Notice that if this field can have null values already stored, then you may overwrite them if you use the expression above. Another alternative is to check the form mode, and if it's in the "NewForm" mode (creating a new item), then use the current date/time like shown below.

If(
EditForm1.Mode = FormMode.New,
Now(),
ThisItem.<dateTimeFieldName>)

View solution in original post

xerxes2985
Level: Powered On

Re: Date, hour, minute picker current date, hour, and minute

@PK_Hong 

Under the drop down control (advanced tab) I've used the following for hour, and left the function line with the standard [00-23] as previously mentioned. - This is working fine.

Text(Now(), "[$-en-US]hh")

 

 

However, on the minute one (using the same method and the [00-59]) It seems to be stuck at the default time for the minutes being at 08

Text(Now(), "[$-en-US]mm")

Any ideas?

View solution in original post

PK_Hong
Level 8

Re: Date, hour, minute picker current date, hour, and minute

Hi @xerxes2985

 

My correction as I am also unaware of the limitation.

Anyway, just use Right() function.

 

Right(Text(Now(), "[$-en-US]hh:mm"), 2),..., to extract right side of hh:mm, to be "mm"

 

Please refer to documentation:

> The m or the mm placeholder must appear immediately after the h or hh placeholder or immediately before the ss placeholder. Otherwise, Text returns the month instead of minutes.

 

Have a nice day

View solution in original post

8 REPLIES 8
bdodu
Level 8

Re: Date, hour, minute picker current date, hour, and minute

And how is this different from the standard implementation of a DateValue DataCard ?

xerxes2985
Level: Powered On

Re: Date, hour, minute picker current date, hour, and minute

The default is blank. I want it to show the current hour, and I want the date to show the current date, and then let you choose other dates.
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Date, hour, minute picker current date, hour, and minute

You can change the Default property of the card (the card that holds the value, not the individual controls) so that if the value is null (which is the case for new items) then it will use the current time instead.

Coalesce(ThisItem.<dateTimeFieldName>, Now())

Notice that if this field can have null values already stored, then you may overwrite them if you use the expression above. Another alternative is to check the form mode, and if it's in the "NewForm" mode (creating a new item), then use the current date/time like shown below.

If(
EditForm1.Mode = FormMode.New,
Now(),
ThisItem.<dateTimeFieldName>)

View solution in original post

xerxes2985
Level: Powered On

Re: Date, hour, minute picker current date, hour, and minute

Sorry for such a delayed response. The first method you provided works fine for the calendar date as a starting and endpoint. Thanks!

Coalesce(ThisItem.EventDate, Now())

 

However, I can't seem to figure out how to apply the same concept to the hour / minute picker. Here is the default code that is in the app:

 

Hour drop down

["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"]

Minute drop down

["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"]

It works to be able to choose what time just fine, but how would I make it so it reflects the current time (as a starting point to choose from)? I've attached a screen capture. Also, there is not a corresponding data card to the drop down lists for hour/minute.

 

PK_Hong
Level 8

Re: Date, hour, minute picker current date, hour, and minute

Hi @xerxes2985

 

For Dropdown, you may alwasy use "Default" value and refer to current time.

eg.: Dropdown.Default = Text(Now(), "hh") for hour, and "mm" for min)

 

Hope this helps.

 

Have a nice day.

xerxes2985
Level: Powered On

Re: Date, hour, minute picker current date, hour, and minute

@PK_Hong 

Under the drop down control (advanced tab) I've used the following for hour, and left the function line with the standard [00-23] as previously mentioned. - This is working fine.

Text(Now(), "[$-en-US]hh")

 

 

However, on the minute one (using the same method and the [00-59]) It seems to be stuck at the default time for the minutes being at 08

Text(Now(), "[$-en-US]mm")

Any ideas?

View solution in original post

PK_Hong
Level 8

Re: Date, hour, minute picker current date, hour, and minute

Hi @xerxes2985

 

My correction as I am also unaware of the limitation.

Anyway, just use Right() function.

 

Right(Text(Now(), "[$-en-US]hh:mm"), 2),..., to extract right side of hh:mm, to be "mm"

 

Please refer to documentation:

> The m or the mm placeholder must appear immediately after the h or hh placeholder or immediately before the ss placeholder. Otherwise, Text returns the month instead of minutes.

 

Have a nice day

View solution in original post

BrownMango69
Level: Powered On

Re: Date, hour, minute picker current date, hour, and minute


@PK_Hong wrote:

Hi @xerxes2985

 

My correction as I am also unaware of the limitation.

Anyway, just use Right() function.

 

Right(Text(Now(), "[$-en-US]hh:mm"), 2),..., to extract right side of hh:mm, to be "mm"

 

Please refer to documentation:

> The m or the mm placeholder must appear immediately after the h or hh placeholder or immediately before the ss placeholder. Otherwise, Text returns the month instead of minutes.

 

Have a nice day


I was fumbling for sometime before I found this post about the mm needing the hh - thank you very much!

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: 103 members 5,375 guests
Please welcome our newest community members: