cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ljkeefe
Helper I
Helper I

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
Super User

@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
Super User

@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
Super User

@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
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,905)