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 / Converting string to S...
Power Apps
Answered

Converting string to ShortDateTime

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

This seems pretty straight forward and not sure what I'm doing wrong:

 

DateValue("7/22/2020 9:00 AM", DateTimeFormat.ShortDateTime)

 

Is returning an empty box. What am I doing wrong? 

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-text 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @morall 

    You must use a 'language code' in the 2nd parameter.  Not a date format.

    DateValue("7/22/2020 9:00 AM", "en-US")

     

    ---
    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."

  • morall Profile Picture
    Microsoft Employee on at

    now I'm confused, how do I convert :

     

    "7/22/2020 9:00 AM"

     

    to a datetime object? 

     

    DateValue("7/22/2020 9:00 AM", "en-US")

     

    evaluated to:

     

    "7/22/2020" and stripped off the time

  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @morall 
    I should have advised you to use the  DATETIMEVALUE function instead.

    DateTimeValue("7/22/2020 9:00 AM", "en-US")

     

    ---
    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." 

  • mdevaney Profile Picture
    29,991 Moderator on at

    @morall 
    Based on your Thumbs Up, did I solve your problem.  Please Accept as Solution if yes!

     

    ---
    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."

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 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard