Calculating days old in number format

Eleni Kalkantzi 41 Reputation points
2022-03-09T20:41:28.837+00:00

Hello,

I have a SharePoint List with the "Created" default column and I would like another calculated column "Days Old", that calculates the difference in days: [Today]-[Created]. I have found a solution for that (JSON column formatting) that works fine but the type of information is text. Is there any suggestion where I can calculate Days Old in a number format?

thank you in advance

181576-image.png

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
0 comments No comments
{count} votes

Accepted answer
  1. Emily Du-MSFT 44,311 Reputation points Microsoft Vendor
    2022-03-10T07:43:11.797+00:00

    @Eleni Kalkantzi

    You could create a number type column, then use following formula in the number column JSON formatting.

    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "txtContent": "=floor((Number(@now )-Number([$Created]))/(1000*60*60*24))"
    }

    Result:

    181811-1.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful