cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bpplls
Helper II
Helper II

Date Format

Good day, 

 

How can I convert this value into a proper format for date and time, 

bpplls_0-1665423148254.png

 

this is the code I use

bpplls_1-1665423200021.pngbpplls_2-1665423244928.png

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Feiteira
Resolver II
Resolver II

Ok, did not knew epoch format, but having that said, I was able to make it work 😀

 

Try this:

Note that I used Int()

Text( Int(ThisItem.creationDate), "[$-en-US]yyyy-mm-dd")

Feiteira_0-1665495533464.png

 

View solution in original post

10 REPLIES 10
Feiteira
Resolver II
Resolver II

Hi there @bpplls ,

 

Was hard to understand what you want, but I think I get it now.

 

Try this one:

 

DateDiff(
    ThisItem.creationDate,
    Now()
) & " days ago"

 

Feiteira_0-1665432195224.png

 

Let me know if it worked out for you and don't forget to "Accept as solution" as well as give the Kudos if this helped you out!! 😀

bpplls
Helper II
Helper II

It doesn't change anything. I cannot seem to format the ThisItem.creationDate

Feiteira
Resolver II
Resolver II

You want to show only the number of days, right?

If so, don't use the Text() to format the date, just use the field itself to do the math.

 

If I'm not undestanding what you need please give us some more information on the field and components you are using

I have an custom connector that returns a creationDate that I use in a gallery

bpplls_0-1665482343575.png


I want first to format the ThisItem.creationDate value into a more accurate format like mm-dd-yyyy, not like its default value "1662626..."

bpplls_1-1665482466654.png

 

then after formatting the value, that's the time I will compute the days between ThisItem.creationDate to present date. Tha'ts why I'm using this code.

bpplls_2-1665482642362.png

 

Feiteira
Resolver II
Resolver II

Are you sure that date is correct in the source or in the connector?

 

It is common to have Dates in Serial Number format but, for example, the serial date number for 1/1/2020 is 43831 as this is the number of days since 1/1/1900. So is somehow weird that you have such a different (and so much bigger) number.

bpplls
Helper II
Helper II

Yup, it is correct. I also tried converting it using other website converter and this is how it shows

bpplls_0-1665493526541.png

 

Feiteira
Resolver II
Resolver II

Ok, did not knew epoch format, but having that said, I was able to make it work 😀

 

Try this:

Note that I used Int()

Text( Int(ThisItem.creationDate), "[$-en-US]yyyy-mm-dd")

Feiteira_0-1665495533464.png

 

WOAH!! Thank you very much for this, I didn't know we can use the "Int" part for the time and date format. Been reading a lot of documentations of powerapps about transforming numbers to time and date but I didn't read that we can use "Int". 


Thank you so much! You're awesome! God bless

Feiteira
Resolver II
Resolver II

GREAT !! This one was not that easy but happy to help 😀

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,685)