Getting the content age in days

Guenter Michalke asked on November 26, 2018 15:55


i need an macro expression which gives me the content age of my document in days. best guess would be: Timespan between CurrentDate and DocumentModifiedWhen in Days. Can anyone help me further?

Best regards,


Correct Answer

Suneel Jhangiani answered on November 26, 2018 16:05

You could use the where field and SQL's built in DateTime function:

Last 7 days:

WHERE ArticleDate >= DATEADD(day, -7, GETDATE())

For a macro you would be able to use:

{% (DateTime.Now - DateTime.Now.AddDays(-7)) |(identity)GlobalAdministrator%}

Edit: I just re-read the question and realized you are trying to find the age of content:

(DateTime.Now - ArticleDate).TotalDays

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.