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

212
Vistas
How to change the format of the Timestamp type from outputted postgresql query?

I'm trying to create a website to monitor the air quality in my room and I want to monitor the time where each measurement was taken. The problem is that when I get my data from my database and print it on my front end, the format of the time column is different from the database. This is the format of the time in the database:

2022-05-16 11:41:00+02

This is all fine and dandy, it contains the correct date and time, and it tells me that my timezone is UTC+2 (Denmark/Copenhagen). But when I need to use this exact date/time on my client, it is printed like this:

2022-05-16T09:41:00.000Z

So it changes the format by inserting the T and the .000Z in the end, as well as subtracting 2 from the hours. How do I change this formatting? Ideally I would like it to look like this:

16-05-2022 11:41

Do I need to define this in my query, or do I have to do it on my server? And how do I do it?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Good afternoon,

You could do like this:

SELECT to_char(current_TIMESTAMP (0) AT TIME ZONE 'Denmark/Copenhagen', 'DD-MM-YYYY HH:MM');

about 4 years ago · Juan Pablo Isaza Denunciar
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