T
Tim Parker

Posted on 25th April 2024|394 views

0
votes

Postgresql Convert Timestamp To Date

Can we convert Timestamp to date format in PostgreSQL?

Answers
P
James ROBERT

Posted on 25th April 2024

  • Yes, we have many ways to convert Timestamp to date by using this DATE() function in PostgreSQL server as we can obtain the date from the Timestamp.

For example:

SELECT DATE(column_name) FROM table_name;

SELECT '1999-05-15 03:45:10'::TIMESTAMP::DATE;

SELECT DATE(SUBSTRING('1999-05-15 03:45:10' FROM 1 FOR 10));

Result:

‘1999-05-15 03:45:10’ ---- ‘1999-05-15’

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos