In order to Get Month from Timestamp in postgresql we use Extract Keyword. Within the Extract keyword we have to mention MONTH as we are getting month from timestamp
Let’s see how to
- Extract month from Timestamp in Postgresql
- Create the column which extracts month from timestamp column
With an example for both
Extract Month from Timestamp in Postgresql:
Within the Extract keyword we have to mention MONTH as we are getting month from timestamp
SELECT EXTRACT (MONTH FROM TIMESTAMP '2010-11-22 13:30:15')
So the resultant month will be
EXTRACT MONTH from Timestamp in column of Postgresql table:
We use table student_detail
Create the column which extracts MONTH from timestamp column in Postgresql
We have created a column and stored MONTH from Birthdaytime column
SELECT *,EXTRACT (MONTH FROM Birthdaytime) AS Month FROM Student_detail
So the resultant table will be