cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
laduy
New Member

Is there any ways to update a part of a DateTime value?

I'm playing with PowerApps DateTime and want to achieve something like this:

  • I have a variable called MyDate that stores a DateTime value: "01/01/1900"
  • I have a dropdown list called MyDay that stores a list of value from 01 to 31 to represent day in a month

 

I want to select a specific value in the dropdown list (i.e: 6) and click a button to update MyDate to "06/01/1900". The point is I just want to update a part of MyDate (day). Is there any ways to do that? I have been looking around but haven not found the solution yet.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@laduy 
Set the Items property of your dropdown to this code

 

 

Sequence(31)

 

 


Then put the following code in the OnChange property of the dropdown.

 

 

Set(myDate,
    Date(
        Year(myDate),
        Month(myDate),
        Self.Selected.Value
    )
)

 

 


---
Please click Accept as Solution if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

2 REPLIES 2
mdevaney
Super User III
Super User III

@laduy 
Set the Items property of your dropdown to this code

 

 

Sequence(31)

 

 


Then put the following code in the OnChange property of the dropdown.

 

 

Set(myDate,
    Date(
        Year(myDate),
        Month(myDate),
        Self.Selected.Value
    )
)

 

 


---
Please click Accept as Solution if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

@mdevaney 
Thanks a lot for the solution. The Date() function is what I'm looking for. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (57,261)