Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f734Phf30855 for ; Fri, 3 Aug 2001 00:25:43 -0400 (EDT) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.1) with HTTP id 96089; Thu, 02 Aug 2001 21:25:40 -0700 From: "Josh Berkus" Subject: Re: converting timestamps to ints To: Morgan Curley Cc: pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.1 Date: Thu, 02 Aug 2001 21:25:40 -0700 Message-ID: In-Reply-To: <4.3.2.7.2.20010802232942.026cf950@e4media.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="_===96089====davinci.ethosmedia.com===_" X-Archive-Number: 200108/24 X-Sequence-Number: 4245 This is a multi-part MIME message --_===96089====davinci.ethosmedia.com===_ Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Morgan, > I am writing an app that will need to do some calcs based on > differences > between when a record is first inserted and when it is last updated. > I have seen a lot of column::data-type in this list but can't find > the > relevant section in the documentation. Can anyone point me in the > right > direction? Hmmm... apparently the docs on date/time data types could use some work. Or some highlighting. Or something. We get this question every week. I'll do it -- can I submit a FAQ in plain text? Anyway, Morgan, thanks to Postgres' robust and ANSI-compliant support of operators, computing intervals is quite simple. DATETIME is a "pure" time value; DATE is an integer representation of time, with days as whole numbers. Thus: DATETIME - DATETIME = INTERVAL DATE - DATE = INTEGER I don't know what's easier for you to work with; DATE/INTEGER is easier for math, and DATETIME/INTERVAL is easier for calendar comparisons. See the docs on data types, functions, and operators at PostgreSQL.org. -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco --_===96089====davinci.ethosmedia.com===_ Content-Type: text/plain Content-Disposition: attachment; filename="" Content-Transfer-Encoding: base64 DQo= --_===96089====davinci.ethosmedia.com===_ Content-Type: text/plain Content-Disposition: attachment; filename="" Content-Transfer-Encoding: base64 DQo= --_===96089====davinci.ethosmedia.com===_ Content-Type: text/plain Content-Disposition: attachment; filename="" Content-Transfer-Encoding: base64 DQo= --_===96089====davinci.ethosmedia.com===_--