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 / Convert text to date a...
Power Apps
Answered

Convert text to date and save it in Sharepoint list

(0) ShareShare
ReportReport
Posted on by 190

Hi,

 

I am trying to convert a string to a date-variable that is accepted by sharepoints date-format:

 

I have a string-variable:

Set(varDateEN;"12/31/2020")

 

I convert this string into date-format: 

Date(Value(Right(varDateEN;4));Value(Left(varDateEN;2));Value(Mid(varDateEN;4;2)))

 

Then I update an item in a sharepoint list including the date value. All values of the item are being updated, except the date.

 

Any ideas what's going wrong? Is there an easier way to convert text to date?

 

Thanks,

Lukas

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,315 Most Valuable Professional on at

     @Lukas1 ,'Have you tried simply

    DateValue(varDateEN)

     as per DateValue function 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Lukas1 Profile Picture
    190 on at

    @WarrenBelz , yes I tried. Doesn't work either.

  • WarrenBelz Profile Picture
    155,315 Most Valuable Professional on at

    Hi @Lukas1 ,

    Actually you should need

    DateValue(varDateEN,"en-US")

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

     

  • Lukas1 Profile Picture
    190 on at

    @WarrenBelz , thanks a lot for your help!

     

    It is still not working. Please have a look at the preview below, I would expect it to be "7/22/2020", but instead it is "22.7.2020":

    Bildschirmfoto 2020-07-22 um 13.13.16.png

     

    I also tried this without success:

    DateValue(varDateEN;"mm/dd/yyyy")

     

  • WarrenBelz Profile Picture
    155,315 Most Valuable Professional on at

    @Lukas1 ,

    What regional code do you have on your SharePoint server? It will convert a date to the local format (and I can see this on the bottom of your code). The fact it converts and shows 22.7.2020 means it is a valid date on the source (there are not 22 months in a year).

    This is also the reason for my first post (you do not need to specify the format if it matches the local format). You cannot store 07/22/2020 format as a date if the source is dd.mm.yyyy

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

     

  • Lukas1 Profile Picture
    190 on at

    @WarrenBelz That's it! I was confused because the dates in my sharepoint list are shown in the US-date-format:

    Bildschirmfoto 2020-07-22 um 13.14.36.png

     

    Anyway, DateValue() with a german date-format is doing the job now.

     

    Thanks again.

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 936

#2
Valantis Profile Picture

Valantis 604

#3
11manish Profile Picture

11manish 518

Last 30 days Overall leaderboard