extract date and time from timestamp column on postgresql

to extract date from coldate,

SELECT date(coldate) FROM mytable;

to extract time, doing time(coldate) will give an error instead,

SELECT "time"(coldate) FROM mytable

another way

SELECT coldate::time FROM mytable


postgresql date/time doc

extract date from timestamp

Advertisements

Published by

paragasu

Different. In a good way

One thought on “extract date and time from timestamp column on postgresql”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s