Extract MILLENNIUM from timestamp in Postgresql

In order to Extract millennium from timestamp in postgresql we will use EXTRACT() function. Let’s see how to

  • Extract millennium from timestamp in postgresql

We will be using student_detail table.

extract millennium from timestamp in postgresql 1

 

Extract Millennium from timestamp in postgresql:

We will use extract() function along with keyword “MILLENNIUM” to extract millennium from  timestamp in postgresql as shown below


SELECT *,EXTRACT (MILLENNIUM FROM Birthdaytime) AS MILLENNIUM FROM Student_detail

So the resultant dataframe with millennium extracted from timestamp will be

extract millennium from timestamp in postgresql 2