cancel
Showing results for
Did you mean:
Responsive Resident

## Date age of item

Hello everyone,

I need to show date differences between two dates for example I need to see days weeks months year old of the record.

at moment I have this formula, but it shows me like numbers 146 days old but i need to see days weeks months year old

``````DateDiff(
ThisItem.Transaction_x0020_Date,
Today()
) ``````

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

The screenshots show how to make one label responsive to a listbox.  If you wanted to show all 4 simultaneously, you could try something like this as the text property of a label.

``````Concatenate(
DateDiff(
ThisItem.'Created On',
Today(),
Days
),
" ",
"Days",Char(10),
DateDiff(
ThisItem.'Created On',
Today(),
Months
),
" ",
" Months",Char(10),
DateDiff(
ThisItem.'Created On',
Today(),
Years
),
" ",
" Years"
)``````
16 REPLIES 16
Super User

DateDiff() has an optional element for showing days, weeks, months, years, etc.  The default is Days

``````DateDiff(
ThisItem.Transaction_x0020_Date,
Today(), UNITS // Units can be Years, Quarters, Months, Days, Hours, Minutes, Seconds or Milliseconds
)``````

Super User

To add to @Drrickryp 's post...just keep in mind that the DateDiff function will not do fractional amounts of units and the units are specific.  Meaning that, when using the DateDiff on January 1 of a year and December 31 of the prior year (one day) will return a result of 1 year difference.

So, you'll need to perform your calculations in specific orders.

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Responsive Resident

@Drrickryp
Sorry I don't understand what you mean when you say Units can be Years, Quarters, how can i add this please

Thanks

Super User

``````DateDiff(
ThisItem.Transaction_x0020_Date,
Today(), Years)
)
or try
DateDiff(
ThisItem.Transaction_x0020_Date,
Today(), Months
)``````

The syntax of the function is DateDiff(startdate, enddate, Units) If the Units is left out it is assumed to be Days.
Please note what @RandyHayes  has posted.  You may want to keep the units as Days but divide your result by 30 to get the true number of months with a fraction.

Super User

Ah, but then you get into the "not every month is 30 days" and "not every year is 365 days".  So...things can be off quickly.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Responsive Resident

@Drrickryp
I got it what you mean but is there a way to show automatically days weeks months and years old to on the label please

Super User

I was trying to keep things a bit more simple.  There is a story told about an NSA meeting where the General Dynamics presenter was saying that their targeting system was so accurate it could place an A bomb on the north west corner of Red Square, to which Dr. Kissinger said, "who cares if they were off by a couple of miles".

Responsive Resident

@RandyHayes
I need roughly to know how old the record I don't care if its off ?

Responsive Resident

Just need the label to show roughly the difference show automatically days weeks months and years

Thanks

Announcements