cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Thuberdeau
Frequent Visitor

Date / Time Formatting

Hey there, 

 

I am trying to return a time format such as 7:56 AM or 10:30 PM (not military time) in a text field by pushing a button. Problem I am having it that the return value includes the date: 8/29/2019 7:56AM.

 

Button formula: UpdateContext({DateNow: Now()})

Field Formula: If(IsBlank(DateNow), ThisItem.'Stop Time', DateNow)

 

I tried incorperating this mask in the formula without success: "[$-en-US]hh:mm AM/PM")

Any ideas?

Txs

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Date / Time Formatting

I used this expression - Text(DateTimeValue("8/29/2019 7:56 AM"),DateTimeFormat.ShortTime)

 

Hopefully this helps.

date time.png


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Date / Time Formatting

I used this expression - Text(DateTimeValue("8/29/2019 7:56 AM"),DateTimeFormat.ShortTime)

 

Hopefully this helps.

date time.png


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Community Support
Community Support

Re: Date / Time Formatting

Hi @Thuberdeau ,

Based on the issue that you mentioned, I think the Text function could achieve your needs. I have made a test on my side, please take a try with the following workaround:7.JPG

 

8.JPG

Set the Text property of the Label to following:

Text(DateNow, "[$-en-US]HH:mm AM/PM")

On your side, you should type following formula:

If(IsBlank(DateNow), Text(ThisItem.'Stop Time', "[$-en-US]HH:mm AM/PM"), Text(DateNow, "[$-en-US]HH:mm AM/PM"))

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (8,313)