cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ljkeefe
Frequent Visitor

Set Date & Time button only sets Time

I've created a form with a Set Date & Time button that should set the date in the date picker and the time automatically. I have two problems:

1. When I press the SetDateTime only the time is set, the date is blank.

2. When the button sets the time, it sets it in 24 hour time...so instead of 1:00PM it's 13:00. I checked the syntax and the date is not set to 24 hour.

I'm more concerned about problem #1.

 

The SetDateTime button has the following:

OnSelect: UpdateContext({varNow:true});Reset(DateValue1);Reset(HourValue1);Reset(MinuteValue1);UpdateContext({varNow:false})

 

Date DropDown(titled DateValue1)I thought the difference in syntax between date and hour & minute might be the issue, I tried Text(Date(Parent.Default) but received an error.

DefaultDate: If(varNOw,Now(),Parent.Default)

DisplayMode:Parent.DisplayMode

 

HourValue1

Default: If(varNow,Text(Hour(Parent.Default),"00"))

DisplayMode: Parent.DisplayMode

 

MinuteValue1

Default: If(varNow,Text(Minute(Parent.Default),"00"))

DisplayMode: Parent.DisplayMode

 

DateCard:

Default: If(varNow,Text(Now()),Parent.DisplayMode)

DisplayMode: Parent.Displaymode

 

Thank you so much for your help!

Linda

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@ljkeefe 

Please consider the following changes to your formulas:

 

SetDateTime button - OnSelect action:   

    UpdateContext({varNow: Now()});

 

Datacard for DateValue1 - Default Property : Coalesce(varNow, ThisItem.yourcolumnname)

 

DateValue1 - DefaultDate Property: Parent.Default

 

HourValue1 - Default Property:  Text(Hour(Parent.Default),"00")

 

MinuteValue1 - Default Property:  Text(Minute(Parent.Default),"00")

 

In Your Form OnSuccess Action, add:  UpdateContext({varNow: Blank()})

 

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User III
Super User III

@ljkeefe 

Please consider the following changes to your formulas:

 

SetDateTime button - OnSelect action:   

    UpdateContext({varNow: Now()});

 

Datacard for DateValue1 - Default Property : Coalesce(varNow, ThisItem.yourcolumnname)

 

DateValue1 - DefaultDate Property: Parent.Default

 

HourValue1 - Default Property:  Text(Hour(Parent.Default),"00")

 

MinuteValue1 - Default Property:  Text(Minute(Parent.Default),"00")

 

In Your Form OnSuccess Action, add:  UpdateContext({varNow: Blank()})

 

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Thanks, Randy! That worked. I made it harder than it was, I suppose. 

RandyHayes
Super User III
Super User III

@ljkeefe 

That happens...Keep It Super Simple and PowerApps will be your best friend!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,286)