Forum Discussion
Date calculation on SharePoint lists between today and a birthdate
- Jan 27, 2022
jensjakobsen1966 there are a couple of ways to do this. One is with a flow in Power Automate that runs once a day and does the calculation. Another is to have a number column and format it with JSON as follows:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "=floor((Number(@now)-Number([$Birthday]))/(1000*60*60*24*12)/365*12)" }
The result is:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
To calculate the difference between today’s date and a birthdate in a SharePoint list, you can use calculated columns with the formula =DATEDIF([Birthdate], TODAY(), "Y"). This formula returns the age in years. You can also modify it to calculate months or days by changing the "Y" to "M" or "D", respectively. Make sure the Birthdate column is of the Date type. This method will dynamically update the age daily as today's date changes.