Re: Resta Horas y dias

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Edwin Quijada <listas_quijada(at)hotmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Resta Horas y dias
Date: 2007-04-12 17:33:50
Message-ID: 20070412173350.GJ15947@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Edwin Quijada escribió:
> UNa pregunta:
> Se podria restar dos fechas timestamp de dias difernetes para q me diga
> cuantas horas han trasncurrido
> Ejemlpo:
>
> 2007-4-12 8:30pm y 2007-4-13 3:00 am
> Aca han pasado 6:30

Conviertelas a tipo timestamptz:

alvherre=# select '2007-4-12 8:30pm'::timestamptz - '2007-4-13 3:00 am';
?column?
-----------
-06:30:00
(1 fila)

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Fernando Dubal 2007-04-12 17:44:32 INSERT INTO SELECT con falla x primary key
Previous Message Victor Lopez 2007-04-12 17:31:21 esquemas y secuencias