Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

434
Views
Extract year from postgres date

If I do the example of documenting works:

SELECT EXTRACT(YEAR FROM TIMESTAMP '2001-02-16 20:38:40');

But integrating it in my query gives an error, it will be very basic, but I do not know what it is.

select
responsable, 
fecha_contratado,
EXTRACT(YEAR FROM TIMESTAMP fecha_contratado) as alta
from rrhh.empleado
where responsable is not null

Thank you very much for the help Postgres 9.3

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You don't need TIMESTAMP keyword in this case, try this:

select
responsable, 
fecha_contratado,
EXTRACT(YEAR FROM fecha_contratado) as alta
from rrhh.empleado
where responsable is not null
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!