D
D
des1roer2015-05-06 11:00:19
PostgreSQL
des1roer, 2015-05-06 11:00:19

Postgres month and year selection?

Is there a more beautiful output of the year and month than this?

select EXTRACT(year FROM TIMESTAMP '2001-02-16') ||'-'|| EXTRACT(MONTH FROM TIMESTAMP '2001-02-16')  ;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Mokhov, 2015-05-06
@des1roer

to_char

D
des1roer, 2015-05-06
@des1roer

select to_char(current_timestamp, 'YYYY-MM') ;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question