Zulfikar S Khan
Zulfikar S Khan

Reputation: 41

PowerApps Date Function

I have created my first power app and in one of the fields I request users to input the date in MM/DD/YYYY format and it gets saved to my excel sheet in teams so for example User inputs "12/30/2021" it's getting saved to excel correctly but when I try to show the same details in Form View to users the date is showing as "44561" when I try to use the Datevalue formula Text(DateValue(Parent.Default),DateTimeFormat.ShortDate) it shows the date as 1/1/4456.

Any help would be appreciated here

Upvotes: 0

Views: 3706

Answers (3)

SeaDude
SeaDude

Reputation: 4385

Excel presents dates in "# of days since the start of a given epoch". Your value of "44560" is the number of days since 1/1/1900* (Excel's time start epoch).

To convert from Excel date to a human readable date in PowerApps, use:

DateAdd(
  DateValue("12/30/1899"),
  44560,
  Days
)

*For backwards compatibility reasons (old bug?), this needs to be changed to 12/30/1899

Upvotes: 1

Monkeymarci
Monkeymarci

Reputation: 1

I once built an app to save the date and was able to reproduce your error.

Picture APP

I created the first data set with 12/30/2021 and got the same error. I then created the second line with 30/12/2021 and got a suitable result.

I have a suspicion that this could be related to the date format in Excel and in Powerapps.

But if you absolutely need the format: 12/30/2021, then I would try a little more.

Upvotes: 0

Monkeymarci
Monkeymarci

Reputation: 1

If I got you right you will just need:

Text(Parent.Default),"dd.mm.yyyy")

This should show your Date in the correct Format.

If this is not working, perhaps you can add some sample Data and picture ?

BR Marcel

Upvotes: 0

Related Questions