Number of days

Started by Mihai Gheorghiualmost 25 years ago3 messagesgeneral
Jump to latest
#1Mihai Gheorghiu
tanethq@earthlink.net

Is there a function that returns the number of days between two dates?
I found only age, which calculates the difference between two timestamps,
but the example shows the result as a timestamp.
Thanks,
Mihai Gheorghiu

#2omid omoomi
oomoomi@hotmail.com
In reply to: Mihai Gheorghiu (#1)
Re: Number of days

select date_part('day','@ 4 days 3 hours 2 mins');

date_part
---------
4

HTH
Omid

From: "Mihai Gheorghiu" <tanethq@earthlink.net>
To: <pgsql-general@postgresql.org>
Subject: [GENERAL] Number of days
Date: Fri, 6 Jul 2001 14:47:39 -0400

Is there a function that returns the number of days between two dates?
I found only age, which calculates the difference between two timestamps,
but the example shows the result as a timestamp.
Thanks,
Mihai Gheorghiu

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mihai Gheorghiu (#1)
Re: Number of days

"Mihai Gheorghiu" <tanethq@earthlink.net> writes:

Is there a function that returns the number of days between two dates?

Subtraction.

regression=# select '27 Feb 2001'::date - '5 Jan 2001'::date;
?column?
----------
53
(1 row)

regards, tom lane