Postgresql: get year from date

Trabla: Postgresql: get year from date

Solving:

1. From Date

select date_part( 'year', date '2015-02-16') 

Result: 2015

2. From Timestamp

select date_part( 'year' , timestamp '2015-02-16 20:38:40')

Result: 2015

No comments:

Post a Comment