Extract Century from timestamp in Postgresql

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

  • Extract century from timestamp in postgresql

We will be using student_detail table.

extract century from timestamp in postgresql 1

 

 

Extract Century from timestamp in postgresql:

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

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

So the resultant dataframe with century extracted from timestamp will be

extract century 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.