Reputation: 21
I have birth_date, which function will let me subtract that from today's date? Thank you
I tried DateDiff using NOW() but that didn't work.
I want to know the person's age as of today
Upvotes: 2
Views: 3829
Reputation: 8097
dateDiff
function should work. Make sure you are adding a calculated field in the data set and not in the analysis.
I was able to get the following to work fine:
dateDiff({my_date},now())
Make sure your birthday field is actually a time or date type and not a string. If it is a string, you'll need to use the parseDate
function to convert it to a date.
One thing to note is that dateDiff
will return the difference in the number of days. I am assuming this could be a very large number for most people so you may want dateDiff({my_date},now())/365
to get an estimate of how many years old they are.
Upvotes: 3