Get Age from birthday in Postgresql

In order to Get age from birthday in postgresql we use AGE() function. AGE() Function in postgresql calculates difference between birth date and current date . Let’s see how to

  • Get Age from Birthday in postgresql using AGE() function.

We will be using Student_detail table.

Get Age from Birthday in Postgresql 1

 

Get Age from birthday in Postgresql

Age function gets the difference between birthday and current date.

select *,age(CURRENT_DATE,date(birthdaytime)) as age from student_detail

so the resultant age will be in years months and days as shown below

Get Age from Birthday in Postgresql 2

 

                                                                                                   

DataScience Made Simple