Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.2/8.9.1) with ESMTP id GAA26269 for ; Tue, 30 Mar 1999 06:49:36 -0500 (EST) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id 3063E4B520; Tue, 30 Mar 1999 11:49:35 +0000 (Asia/Jerusalem) Received: from [147.233.148.140] (1164.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA19EC; Tue, 30 Mar 1999 13:51:21 +0200 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <36FFE017.9E1F65A2@ricken.demon.co.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Tue, 30 Mar 1999 13:51:16 +0200 To: Rick Dearman From: Herouth Maoz Subject: Re: [GENERAL] Returning an integer from a date Cc: pgsql-sql@postgreSQL.org At 22:18 +0200 on 29/03/1999, Rick Dearman wrote: > > I want the number of seconds since 1970 Basically, the function date_part( 'epoch', expression_of_datetime_type ) returns the number of seconds since 1970. But it returns a float, not an integer, because datetimes can include milliseconds etc. For example: testing=> select date_part( 'epoch' , '1999-03-01 07:38:01.10'::datetime); date_part ----------- 920266681.1 (1 row) So, you may either write your program to expect a float there (float8), or you can force it to be an integer using the function int() around the date_part function. But then you lose the milliseconds. Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma