Re: diff between two timestamps.

From: Harry Broomhall <harry(dot)broomhall(at)uk(dot)easynet(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: diff between two timestamps.
Date: 2003-07-29 10:20:47
Message-ID: 200307291020.LAA05766@haeb.noc.uk.easynet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

HK writes:
> Hi all,
> Can i get the difference between two timestamps in seconds.
> If i use
> t1 timestamp;
> t2 timestamp;
> select t1 - t2;
> i get something like "10 days" or "00:10".
>
> Can i get the number of seconds elapsed between the two timestamps.
> Plz help me. I am trying the first time using the stored procedures.

Use extract(epoch from interval) to get this. More details can be
found in the Functions and Operators section of the Users Guide.

Regards,
Harry.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Mel Jamero 2003-07-29 11:20:38 Re: Retrieving NULL records
Previous Message Mel Jamero 2003-07-29 10:15:46 any idea regarding this error?