Custom Date expression / format help
Good afternoon. I need to create a custom date expression that basically inputs the birthdate of somebody who is 10 years old. So this expression needs to take today's date and subtract 10 years, formatted mm/dd/yyyy and input that date into a text box formatted mm/dd/yyyy .
What is the correct expression to use with the Expression Editor? I have an attached screenshot.
If there is a better way to do this, please advise.
Thank you in advance.
Hi DCat1223,
You can use the aqDateTime and aqConvert objects to build the needed expression.
aqDateTime.Today() returns today's date.
aqDateTime.AddMonths(date, -120) subtracts 10 years (120 months) from a date.
aqConvert.DateTimeToFormatStr(date, "%m/%d/%Y") formats a date as "mm/dd/yyyy".With all of these combined, your expression would be:
aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Today(), -120), "%m/%d/%Y")