Calculate the birthdate of a 18 year old person

From SMTX Wiki
Jump to navigation Jump to search

Below is an example code to calculate the birthdate of a person that turns 18 today

format('{0:yyyyMMdd}', DateAdd(ToDate('#REPLACE-FORMFIELD-FormName||TodayDateField||#'), -18, 'Y'))

Alternatively you can also use the Now function:

format('{0:yyyyMMdd}', DateAdd(Now(), -18, 'Y'))