Re: Date Time calculation help - Mailing list pgsql-sql

From Steve Boyle \(Roselink\)
Subject Re: Date Time calculation help
Date
Msg-id 00eb01c19dc1$b6bea180$c55869d5@dualtower
Whole thread Raw
In response to Date Time calculation help  ("Unnikrishnan Menon" <unnikrishnan.menon@chennai.transys.net>)
List pgsql-sql
Unnikrishanan,
 
The following query will return the number of whole days between the two dates (a working version of postgres query you posted).
 
select date_part('day','now'::datetime - '2001-01-15'::datetime);
Other available datetime functions can be found at:
 
hih
 
steve boyle
----- Original Message -----
Sent: Monday, January 14, 2002 2:58 PM
Subject: [SQL] Date Time calculation help

Hi,
 
I have a particular query in Oracle :
 
select mod((sysdate - to_date('15-JAN-02','dd-mon-yy')),1) from dual;
The above query gives 0.752.. as the difference between the two days which when multiplied by 24 gives around 3.1.. hrs.
 
I tried the same query in postgresql but the value returned is 0.
The query was:
select mod((current_date - '2002-15-01')),1);
 
I require the difference in time to the last second to be shown as time left. Could anyone suggest as to how to overcome this particular problem.
 
Thanx in advance,
 
Unni

pgsql-sql by date:

Previous
From: "Steve Boyle \(Roselink\)"
Date:
Subject: Re: On delete cascade!
Next
From: Paulo Rodrigues
Date:
Subject: Hierarchical queries