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 / DateTimeFormat.ShortTi...
Power Apps
Answered

DateTimeFormat.ShortTime24 still shows ugly long datetime

(0) ShareShare
ReportReport
Posted on by 267

I have a SQL DateTimeOffset field (yes, I converted them to this handy international SQL datatype as suggested for Power Apps in Working with date/time values and SQL Server | Microsoft Power Apps).

 

We need to show times without their dates, eg "17:45", however for some reason the Power Apps Format on Text Input control of DateTimeFormat.ShortTime24 still shows the ugly underlying long datetime, like "30/12/1899 17:45". This is nasty and very confusing to users. I thought the whole point of ShortTime24 would be exactly what is says. There's no good in using the Time() function because that's just for converting Text, whereas we do have the correct underlying datatype (so it causes an error).

 

Naturally, this applied to the standard SQL DateTime datatype as well as newer DateTimeOffset, so no fix there.

 

Is this a bug / unimplemented functionality, or am I missing something? What is the best practice for showing and editing short Times which can be patched back to the database?

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @TickboxPhil 

    Can you share the formula you are currently using for the Text function?

    In general, you can format dates and times in ANY way that you want.  The built in formats are there for your convenience, but you can always apply any format you want.

    So, if you just want the short time only and not the short time (by the way "30/12/1899 17:45" is short date and short time), then you can always do the text format you want:  Text(yourColumn, "hh:mm")

     

    I hope this is helpful for you.

  • TickboxPhil Profile Picture
    267 on at

    Thanks @RandyHayes - I'm not using anything for the Text function yet, was expecting the DateTimeFormat.ShortTime24 to do the job and format the underlying datatype value. But it doesn't - however reading Show text, dates, and times in a canvas app - Power Apps | Microsoft Docs closer it looks like it mainly applies to the Text property of a Label, not this Text Input control. As the property is actually available to the Text Input control too, it should be applied and not show the whole underlying SQL DateTime, but seems to be overridden and will leave that for now.

     

    So, your idea of applying Text(yourColumn, "hh:mm") does work nicely even on the Text Input control - brilliant, and is the accepted answer here. What's great is that it also applies to the edit and patch as well as display, so when the user goes into it, they don't even see the underlying date part of the DateTime. Phew!

     

    Taking this further, I can see a few issues with the DateTimeOffset between PA and SQL, a great idea and will test that further but am currently reverting back to non-offsets. In fact, this was a legacy database pre-SQL Server 2008 and that later release included the Time datatype (I wish we had that 2 decades ago where we had to use integers for timesheet apps instead), so I'm now converting over to those in the backend on new Azure SQL DB. Your suggestion remains a key tool in making any DateTime/Offsets work in Power Apps, overriding the DateTimeFormat. Many thanks!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard