Recently there was a scenario, where based on user’s date of birth, it is required to get date of birth with respect to current year. Ex- If date of birth is 23-01-1986, then based on current year it should display 23-01-2018.
Since data is stored as date field in SharePoint list, the easiest option was to use calculated formula which gives the date in current year keeping month and date intact.
Considering column name is “DOB” (date type), create a “Today” column of type “Single Line of Text” and “DOBC” column to type “Calculated”. Make sure that return type of calculated column is date type.
Now use below formula in calculated field-
=DATE(YEAR(DOB)+DATEDIF(DOB,Today,”Y”),MONTH(DOB),DAY(DOB))
OR
=DATE(YEAR([Today]),MONTH([DOB]),DAY([DOB]))
Once formula is set, save the column. Delete the “Today” column now.
I can get neither to work in SharePoint 2016.
LikeLike