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 / Date Expression - Text...
Power Apps
Answered

Date Expression - Text Label vs. Text Input?

(0) ShareShare
ReportReport
Posted on by 987

I have used the same function for a text label and a text input control. But the returned values are different. I have two questions:

 

1. Why are the formats different if the expression is the same? (The only difference with the top one is that it has a prefix of
"Date/Time: " & ) - I literally copied the expression from the top text box to the bottom one, and only deleted the prefix.
See screen shot below to understand what I mean by variance :
--Label has regular time,
--Input Box has military time, and
--Label has AM PM and Input Box doesn't

2. Is there anything special I need to do in order to submit the input value (bottom one shown in image) to a date column in SharePoint (right now it doesn't seem to be working)?

 

Notes:

--We are using these dates to log items from paper (so we can't use created and modified times on SharePoint)

--I'm not using the Power App templates, I'm patching the data down to SharePoint. i.e. Patch() function.

 

Thank you in advance for your help.

 

Time Variance.PNG

Categories:
I have the same question (0)
  • AndyPennell Profile Picture
    Microsoft Employee on at

    If you always want 12-hour time in US format, use a formula of Text(Now(),"mm/dd/yyyy hh:mm:ss am/pm")

     

    I cannot explain why one is different to the other though, I get 24-hour time by default for both on my machine.

     

    (Sorry I dont know anything about submitting dates to SP).

  • rgruian Profile Picture
    Microsoft Employee on at

     

    Can you please list here the exact expressions for your two controls? I can see one of them, the other one is unclear to me.

     

    One thing to note is that date/time values in PowerApps are not text/strings. They are numeric, and flow through the dataflow graph from / into controls as such. At the point where they need to be presented in text form, they are projected to strings. This typically happens in one of three main ways:

     

    1. Explicit projection using the Text function. The format is specified in the formula. E.g. label.Text = Text(dt, "mm/dd/yyyy hh:mm a/p")

    2. Implicit projection via type coercion from date/time to text. The format is fixed and culture-specific. For en-US, it's typically "mm/dd/yyyy hh:mm:ss a/p". For example: label.Text = Now()

    3. Implicit projection by a control that manipulates date/time values. An example would be a calendar control.

     

    I am trying to understand what your formulas are, so I can see which of these cases actually kick in (in your case).

     

     

    Regarding your second question, I suspect the date/time value for SharePoint needs to be properly typed. You should be able to use the DateTimeValue or DateValue functions (as appropriate) to convert text, for example from a TextInput control, to a date/time value compatible with SharePoint.

  • audrieFCT Profile Picture
    987 on at

    Here are the two expressions my apologies for being unclear. These expressions plus the screen shot should further clarify:

     

    In the label:

    Text( "Date/Time: " & Now(), "mm/dd/yyyy hh:mm:ss" )

     

    In the Text Input Box (Default value that the consumer of the form can edit):

    Text(Now(), "mm/dd/yyyy hh:mm:ss" )

     

     

     

  • Verified answer
    AndyPennell Profile Picture
    Microsoft Employee on at

    The Label one needs to do the concatenation outside the Text function:

    "Date/Time: " & Text(Now(), "mm/dd/yy hh:mm:ss am/pm")

     

    Now() is not a string: it returns a date. Whenn you add it to the string it converts it and loses its "date-ness".

  • audrieFCT Profile Picture
    987 on at

    LOL - that's funny because that is the one that was working as I expected! Let me try that and see if I now have two problems.

     

    Thank you - will post back here as soon as I give it a try.

  • rgruian Profile Picture
    Microsoft Employee on at

    What Andy pointed out is correct. string & date will coerce the right hand side (a date numeric value) to a string using a predefined format. If you need to use a specific format, you need to perform that projection from date/value to text yourself.

     

    In the label:

    "Date/Time: " & Text(Now(), "mm/dd/yyyy hh:mm:ss")

     

     

  • audrieFCT Profile Picture
    987 on at

    That works perfectly Andy!! Thanks so much to both of you.

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard