Get Microseconds from Timestamp in Postgresql

In order to get Microseconds from Timestamp in postgresql we use Extract Keyword. Within the Extract keyword we have to mention MICROSECONDS as we are getting MICROSECONDS from timestamp.

Let’s see how to

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

With an example for both

Extract Microseconds from Timestamp in Postgresql:

Within the Extract keyword we have to mention MICROSECONDS as we are getting Microseconds from timestamp

SELECT EXTRACT (MICROSECONDS FROM TIMESTAMP '2011-11-22 13:30:15.203')

So the resultant MICROSECONDS will be

Get Microsecond from timestamp in postgresql in 2

 

EXTRACT Microseconds from Timestamp in column of Postgresql table:

We use table student_detail

Get Microsecond from timestamp in postgresql in 1

 

Create the column which extracts MICROSECONDS from timestamp column in Postgresql

We have created a column and stored Microseconds from Birthdaytime column

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

So the resultant table will be

Get Microsecond from timestamp in postgresql in 3

 

                                                                                                           

DataScience Made Simple