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

 

                                                                                                         

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.