From: Steve Boyle \(Roselink\) <boylesa@roselink.co.uk>
To: Unnikrishnan Menon <unnikrishnan.menon@chennai.transys.net>
To: pgsql-sql@postgresql.org
Subject: Re: Date Time calculation help
Date: Tue, 15 Jan 2002 12:39:46 -0000
Message-ID: <00eb01c19dc1$b6bea180$c55869d5@dualtower> (raw)
References: <005e01c19d79$16219db0$e90aa8c0@UNNIKRISHNAN>
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:
http://www.il.postgresql.org/users-lounge/docs/7.1/postgres/functions-datetime.html
hih
steve boyle
----- Original Message -----
From: Unnikrishnan Menon
To: pgsql-sql@postgresql.org
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: boylesa@roselink.co.uk, unnikrishnan.menon@chennai.transys.net
Subject: Re: Date Time calculation help
In-Reply-To: <00eb01c19dc1$b6bea180$c55869d5@dualtower>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox