DateDiff / TimestampDiff

I'm trying to get the age of the person when they placed the order. The code works, but not on every record, I 've included the results. It for some reason does the calculation when the record is in UTC, but not in a different format. What can I do because I don't have access to changing the data table.

results

select Orders.created_at,Profiles.date_of_birth AS Profiles__date_of_birth,
TIMESTAMPDIFF(YEAR, Profiles.date_of_birth, CURRENT_DATE()) AS Age
FROM
travelers
LEFT JOIN
profiles Profiles ON travelers.profile_id = Profiles.id
LEFT JOIN
orders Orders ON travelers.order_id = Orders.id

you can export that table, fix the dates, then use the upload csv feature to upload a new table and work on that new one

I can't do that, I'm not an admin, just a user, so no access to uploading anything. I was just wondering if there was something I could do within the sql to work with it.

How about a case statement with different when statements for the different date formats?

hmm. that sounds like a good idea, do you now where I can find information on what formats are available to check for?

Thanks. I would do a select distinct on Profiles_date_of_birth to see what you have in the dataset.

You could check through the online documentation for Metabase to learn about the different date formats.

When I get stuck, I check available resources on the internet.

thanks for the tips, I will try that out.

You're welcome.