Get Day from Timestamp in Postgresql

In order to Get day from Timestamp in postgresql we use Extract Keyword. Within the Extract keyword we have to mention DAY as we are getting day from timestamp

Let’s see how to

  • Extract day from Timestamp in Postgresql
  • Create the column which extracts day from timestamp column

With an example for both

 

Extract day from Timestamp in Postgresql:

Within the Extract keyword we have to mention DAY as we are getting day from timestamp

SELECT EXTRACT (DAY FROM TIMESTAMP '2010-11-22 13:30:15')

So the resultant day will be

Extract Day of the week from timestamp in postgresql 2

 

EXTRACT DAY from Timestamp in column of Postgresql table:

We use table student_detail

Extract Day of the week from timestamp in postgresql 1

 

Create the column which extracts day from timestamp column in Postgresql

We have created a column and stored DAY from Birthdaytime column

SELECT *,EXTRACT (DAY FROM Birthdaytime) FROM Student_detail

So the resultant table will be

Get date from timestamp 3