Re: date time function

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Jasbinder Singh Bali <jsbali(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: date time function
Date: 2007-06-28 20:13:44
Message-ID: 46841678.4090701@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 28/06/2007 21:04, Jasbinder Singh Bali wrote:

> How can i convert this result into absolute number of days.

Cast your result to type INTERVAL - something like this:

postgres=# select (current_timestamp - timestamp '2007-05-01')::interval;

interval
----------------------
58 days 21:10:36.748
(1 row)

Of course, you'll need to decide how to handle the part of a day left over.

HTH,

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
---------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sergei Shelukhin 2007-06-28 20:22:54 what's wrong with this conf file?
Previous Message Jasbinder Singh Bali 2007-06-28 20:04:48 date time function