I have a variable (SubmitValue) that I'm using to store a text variable. In one case, that is coming from a dropdown, and in this case it needs to come from a date picker (DatePicker1). I'm storing it in a string variable because I'm writing it back to a varchar datatype in sql server.
I've set the OnChange property of the date picker to:
Set(SubmitValue, (DatePicker1.SelectedDate))
I also have a label set to the variable name. When I choose a date (3/10/2020), the label comes across as:
1583812800000
How do I get it to come across as the actual date selected?
Solved! Go to Solution.
just change your current code to the following:
Set(SubmitValue, Text(DatePicker1.SelectedDate,DateTimeFormat.ShortDate))
That will format the date as a string and prevent it from converting to Ticks
I think you can convert the number to a date like this. Let me know if it works for you.
Date(1970,1,1) + 1583812800000/(60*60*24*1000) )
---
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."
just change your current code to the following:
Set(SubmitValue, Text(DatePicker1.SelectedDate,DateTimeFormat.ShortDate))
That will format the date as a string and prevent it from converting to Ticks
Hey there @mdevaney
If I understood your code, I'm getting the same value:
Set(SubmitValue, DatePicker1.SelectedDate); Set(SubmitValue, Date(1970,1,1) + SubmitValue/(60*60*24*1000))
Try changing the name of the variable. It works for me without error, but it may be giving you trouble since the variable was already created with a data value rather than a string.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
195 | |
45 | |
45 | |
40 | |
36 |
User | Count |
---|---|
270 | |
81 | |
81 | |
75 | |
70 |