Skip to main content

Posts

Showing posts with the label CURRENT_TIMESTAMP

How to convert date difference into years in SQL

Add below in your SQL query and it will get date difference and convert into years: (DATEDIFF(MONTH,TABLE.BIRTH_DT,CURRENT_TIMESTAMP)/12) The DATEDIFF() function returns the difference between two dates. DATEDIFF(Interval, date_1, date_2) The CURRENT_TIMESTAMP() function returns the current date and time. SELECT CURRENT_TIMESTAMP()