How to Display “Time Ago” Labels in Power Apps (Just Now, Minutes, Hours, Days, Weeks, Months, Years)

When creating apps in Power Apps, it’s often more user-friendly to show dates and times in a natural, readable format — for example:

  • Just now
  • 5 minutes ago
  • 3 days ago
  • 2 months ago
  • 1 year ago

Instead of displaying the raw Created or Modified date from SharePoint or Dataverse, you can use Power Fx formulas to transform those values into this “time ago” format. You can refer to the image below to see what it looks like:

Display Time Ago Labels in Power Apps

In this article, I will explain how to display time ago labels in Power Apps with examples for minutes, hours, days, weeks, months, and years.

Display Time Ago Labels in Power Apps

First, I will show you how it works individually, and then I will show you how it works altogether.

Created DateOutput
1 min agoJust now
35 min ago35 min ago
3 hours ago3 hr ago
Yesterday1 day ago
10 days ago1 week ago
45 days ago1 month ago
200 days ago6 months ago
500 days ago1 year ago

Display “Just Now” or “Minutes Ago” in Power Apps

Here, we can calculate the difference in minutes between the current time and the item’s created time. Also, you can take any SharePoint custom Date field instead of the Created column.

With(
    { diffMins: DateDiff(ThisItem.Created, Now(), Minutes) },
    If(
        diffMins < 1,
            "Just now",
        diffMins < 60,
            diffMins & " mins ago"
    )
)

Example:

  • If the record was created just now -> Just now
  • If it was created 35 minutes ago -> 35 mins ago

Display “Hours Ago” in Power Apps

Once the difference goes beyond 60 minutes, it is calculated in hours.

With(
    { diffMins: DateDiff(ThisItem.Created, Now(), Minutes) },
    If(
        diffMins < 60,
            diffMins & " mins ago",
        diffMins < 1440,
            RoundDown(diffMins/60,0) & " hrs ago"
    )
)

Example:

  • If the item was created 2 hours ago -> 2 hrs ago
  • If it was created 10 hours ago -> 10 hrs ago

Display “Days Ago” in Power Apps

If the timestamp is older than 24 hours but less than 7 days, we display ‘days ago’.

With(
    { diffMins: DateDiff(ThisItem.Created, Now(), Minutes) },
    If(
        diffMins < 1440,
            RoundDown(diffMins/60,0) & " hr ago",
        diffMins < 10080,
            RoundDown(diffMins/1440,0) & " day(s) ago"
    )
)

Example:

  • If the item was created yesterday -> 1 day ago
  • If it was created 3 days ago -> 3 days ago

Display “Weeks Ago” in Power Apps

For differences of more than 7 days but less than a month, we can use weeks.

With(
    { diffMins: DateDiff(ThisItem.Created, Now(), Minutes) },
    If(
        diffMins < 10080,
            RoundDown(diffMins/1440,0) & " day(s) ago",
        diffMins < 43200,
            RoundDown(diffMins/10080,0) & " week(s) ago"
    )
)

Example:

  • If the item was created 10 days ago -> 1 week ago
  • If it was created 20 days ago -> 2 weeks ago

Display “Months Ago” in Power Apps

Once the timestamp is older than 30 days but less than a year, we can display it as months.

With(
    { diffMins: DateDiff(ThisItem.Created, Now(), Minutes) },
    If(
        diffMins < 43200,
            RoundDown(diffMins/10080,0) & " week(s) ago",
        diffMins < 525600,
            RoundDown(diffMins/43200,0) & " month(s) ago"
    )
)

Example:

  • If the item was created 45 days ago -> 1 month ago
  • If it was created 90 days ago -> 3 months ago

Display “Years Ago” in Power Apps

If the difference is more than a year, we can display it as years.

With(
    { diffMins: DateDiff(ThisItem.Created, Now(), Minutes) },
    If(
        diffMins < 525600,
            RoundDown(diffMins/43200,0) & " month(s) ago",
        RoundDown(diffMins/525600,0) & " year(s) ago"
    )
)

Example:

  • If the record was created 400 days ago -> 1 year ago
  • If it was created 900 days ago -> 2 years ago

All Cases Together [Now, Minutes, Hours, Days, Weeks, Months, Years]

Now you can see the complete formula combining all of the above. To do this, follow the instructions below:

1. I have a SharePoint list (IT Service Tickets) that contains various fields, including a ‘Submitted Date‘ field. Now I would like to display the Time ago in the Power Apps gallery according to the submitted date field.

Display Time Ago Power Apps

2. In Power Apps, insert a gallery (connected to the above SharePoint list) and add a Label to it. Apply the code below to the Label’s Text property:

With(
    {
        diffMins: DateDiff(
            ThisItem.'Submitted Date',
            Now(),
            TimeUnit.Minutes
        )
    },
    If(
        diffMins < 1,
        "Just now",
        diffMins < 60,
        diffMins & " min ago",
        diffMins < 1440,
        RoundDown(
            diffMins / 60,
            0
        ) & " hr ago",
        diffMins < 10080,
        RoundDown(
            diffMins / 1440,
            0
        ) & " days ago",
        diffMins < 43200,
        RoundDown(
            diffMins / 10080,
            0
        ) & " weeks ago",
        diffMins < 525600,
        RoundDown(
            diffMins / 43200,
            0
        ) & " months ago",
        RoundDown(
            diffMins / 525600,
            0
        ) & " years ago"
    )
)

Refer to the screenshot below:

Power Apps Display Time Ago Labels

3. Finally, preview the app, and you can see all the times are displaying with a ” time ago” label inside the gallery, as shown below:

Display Time Ago Labels in Power Apps

I hope this article helped you learn how to display “time ago” labels in Power Apps. It helps users quickly understand when something happened without having to think about exact dates and times by using a few simple Power Fx formulas.

Also, you may like some more Power Apps tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…