Re: Date difference in seconds

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Raghunath T" <raghunatht(at)mindtree(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Date difference in seconds
Date: 2001-02-23 18:04:46
Message-ID: 28779.982951486@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Raghunath T" <raghunatht(at)mindtree(dot)com> writes:
> Now I want the difference between start time and end time in seconds.
> Select date_part('seconds',start_time - end_time) from temp; gives
> me only the difference between the seconds value in both timestamps. It
> ignores all the days, hrs, minutes etc.

Try "date_part('epoch',start_time - end_time)". See
http://www.postgresql.org/devel-corner/docs/postgres/functions-datetime.html

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-02-23 18:15:58 Re: Re: how critical is WAL
Previous Message fabrizio.ermini 2001-02-23 17:51:19 Request for thoughts...