Skip to content
Advertisement

Calculate age from date of birth with formatting

I would like to calculate the age from the date of birth stored as a string using the format in the comments in the code. Here’s my code: The result I get is the following: I guess there’s something wrong with the year but I can’t figure it out! Answer The error is in this line: You should not call

Date Format Convert

I am dealing with sql DB where the date is recorded in this format ‘2020-348T08:55’. I need to convert this to datetime. Please guide if there is possible way to do that? Answer With string and date/time functions extract the year and days to create a DATETIME without the time and finally add the time part: If the days part

Advertisement