Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

294
Vistas
node-postgres current_date gives me yesterday as current date

I am using the npm library pg to print the current date, however it gives the date of yesterday with the time set to 21:00:00.000Z.


const { Client } = require('pg')
const client = new Client();
(async function fn() {
    await client.connect();
    const res = await client.query("SELECT current_date");
    const rows = res.rows;
    /** @type { Date } */
    const dt = rows[0]['current_date'];
    console.log(dt); // 2022-06-04T21:00:00.000Z
    await client.end();
})();

When I issue the command from psql I get the correct current date ("2022-06-05").

SELECT current_date;

My timezone is UTC+03 so I am guessing it has to do with why I am getting this kind of date, but beyond that I dont know.

Kindly help explain.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda