Extract time part from timestamp in Postgresql

In order to Extract time part from timestamp in postgresql we will first typecasting them to timestamp and then to time. Let’s see how to

  • Extract time part from timestamp in Postgresql

We will be using student_detail table.

Extract time part from timestamp in postgresql 1

 

Extract time part from timestamp in postgresql:

We will first typecasting them to timestamp and then to time as shown below

select *,birthdaytime :: timestamp :: time  from student_detail

So the resultant dataframe with time extracted from timestamp will be,

Extract time part 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.