web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Saving Dates in year-m...
Power Apps
Answered

Saving Dates in year-month-day format

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

Following instructions from a popular power apps book for saving dates in year-month-day format. According to the PowerApps book the following should work provided my source excel column is formatted as text. this is what is in the 

 

DateTimeValue(Left(Parent.Default, 4) & "-" & Mid(Parent.Default, 5,2) & "-" & Mid(Parent.Default, 7,2) & " "& Mid(Parent.Default,9,2) & ":" & Mid(Parent.Default,11,2))

 

I have followed all the directions and still no joy, it's complaining that it is expecting text in the left & mid functions. Any help is appreciated! Attached is a screen shot and excel file.

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,024 Most Valuable Professional on at

    The fact that the Data Card has a Date control in it, unless you unlocked it and added it manually, would suggest that the field being brought in from Excel is NOT formatted as a text field. I replicated your setup and when I added the data card for the date column it comes in as a text field.  The only way to get a datepicker is to unlock the card and add it manually.  AFter doing that I got the date loaded when I used the following.

    DateTimeValue(Concatenate(Left(Parent.Default,4),"-",Mid(Parent.Default,5,2),"-",Mid(Parent.Default,5,2)))

    That's essentially the same as yours except I used the Concatenate function instead of the '&' operations.  I don't think the issue is with the formula.  I think the problem is the data mapping in your Excel file.  Did you format the cells as Text in the table or leave it as General? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi thanks for your input. I selected the date column and formatted it as text. The date picker was from when I started my app using the auto generate from excel data feature. I then unlocked the card for the date and removed the hour and minutes picked and all references to them.

  • Verified answer
    Pstork1 Profile Picture
    69,024 Most Valuable Professional on at

    I would remove the whole card itself and re-add it to the form.  Since it was originally a date card, its expecting the input to be a date.  That's why Parent.Default isn't registering as a string.

     

    When you re-add it the card will come in with a textbox.  Just unlock the card, remove the text box (or hide it) and add a datapicker.  Then setup your formula and it should work.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    That's IT!!! you pointed me in that direction and I did exactly as you just suggested put new card in and new date picker and it works! Thank you!!

  • eka24 Profile Picture
    20,923 on at

    Please mark @Pstork1 reply as the Solution if it has been solved

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Pstork1

    Thanks for the help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard