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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Converting Text Input ...
Power Apps
Unanswered

Converting Text Input to TimeValue

(0) ShareShare
ReportReport
Posted on by 437 Super User 2024 Season 1

Having trouble converting text input to TimeValue on form update.  On existing records, it display just fine:

 

BrianM_2-1707940905914.png

 

But when entering a new record, I get a conversion error:

 

BrianM_1-1707940860234.png

 

Field default is "Parent.Default"

DataCard default is "TimeValue(ThisItem.ServiceTime)

Source format is datetime2(7) in SQL

 

Categories:
I have the same question (0)
  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Brian-M 

    What's the formula in the Update property of the card? The formula here is the most likely cause of the error.

    Because datetime2 is a datatype that expects a date component in addition to the time, I would expect a formula that creates a datetime, perhaps based on the "Appt Date" value. If this is blank (as in the case of your screenshot), this would be a cause of the error.

  • Brian-M Profile Picture
    437 Super User 2024 Season 1 on at

    @timl , the update field says, "TimeValue4", which is name of the text input field.  I also tried:

     

    TimeValue(TimeValue4)

     

    but that didn't prevent the error

     

    Also, this seems odd to me.  It looks like TimeValue is converting to Date/Time (as expected) but still getting the error in Live mode:

     

    BrianM_1-1708013659201.png

     

  • Brian-M Profile Picture
    437 Super User 2024 Season 1 on at

    I have more information.  I tried testing on SQL fields using datatype Time and varchar and I'm still getting the error, so I don't think the issue is the SQL column format.  Now I'm just confused.

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Brian-M 

    I'd try specifically referencing the Text property of the text input control. Perhaps that might work more reliably in Live mode.

    TimeValue(TimeValue4.Text)

     

  • Brian-M Profile Picture
    437 Super User 2024 Season 1 on at

    Yup, I found that error and corrected it.  It now refers to TimeValue4.Text.  But still getting same error.  I even tried setting the source as both Time and varchar to see if it was the source.  Still get the same error.   I've tried it with TimeValue, without TimeValue with "Text(TimeValue4.Text, "hh:mm AM/PM"), etc... still receiving the error.

     

    I don't get it.  How do you submit something like "10:30 AM" through a form?   I can do it through a Gallery without any problems, but not a form.

  • Verified answer
    Brian-M Profile Picture
    437 Super User 2024 Season 1 on at

    After doing a lot of research and testing I've reached two conclusions:

     

    1.  When you need to enter a time like "10:30 AM" with SQL, your datatype should be varchar only.  There's really no other option as PowerApps doesn't even really play nicely with Time format.  Note here though that this ONLY applies to FORMS.  Using datatime2 and displaying "10:30 AM" seems to work just fine in a GALLERY.  But in a form, it does not work at all

     

    2. Something has happened with my current form that cannot be fixed.  Removing and adding back the field I need to use with a Time was the only way to fix the formatting error, even after I changed the source type to varchar.

     

    3. With varchar as your source type, you'll need to use "TimeValue(ThisItem.Time)" as your form field Default to display it properly.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard