X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8ACFED80FB for ; Tue, 18 Oct 2005 18:20:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38112-09 for ; Tue, 18 Oct 2005 21:20:23 +0000 (GMT) Received: from TWMAIL.ESNCC.COM (static-66-173-159-28.t1.cavtel.net [66.173.159.28]) by svr1.postgresql.org (Postfix) with ESMTP id DC032D7E11 for ; Tue, 18 Oct 2005 18:20:24 -0300 (ADT) Received: from spawar2i8uvlb9 ([150.125.117.63]) by TWMAIL.ESNCC.COM with Microsoft SMTPSVC(5.0.2195.6713); Tue, 18 Oct 2005 17:20:27 -0400 From: "Lane Van Ingen" To: Subject: Re: What Am I Doing Wrong? Date: Tue, 18 Oct 2005 17:20:25 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 Importance: Normal In-reply-to: X-OriginalArrivalTime: 18 Oct 2005 21:20:27.0393 (UTC) FILETIME=[C29FD710:01C5D429] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 required=5 tests=[AWL=0.006, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/187 X-Sequence-Number: 23040 Ignore my request. The solution is: --------------------------- computeIfUptime() ------------------------------------- select (EXTRACT(EPOCH from TIMESTAMP 'now') - EXTRACT(EPOCH from TIMESTAMP '2005-10-18 17:00:00'))::integer -----Original Message----- From: Lane Van Ingen [mailto:lvaningen@esncc.com] Sent: Tuesday, October 18, 2005 3:39 PM To: pgsql-sql@postgresql.org Subject: What Am I Doing Wrong? I have been trying to subtract two timestamps from each other to determine the difference between the two timestamps (current time and a past timestamp called 'updated_time') IN SECONDS, but no luck. The trouble I am having is getting the first timestamp, representing the current time, to translate to seconds; have tried different commands (now(), localtimestamp, current_timestamp, etc) What am I doing wrong? Sample statement and error message is below: ------------------------------------------ select EXTRACT(EPOCH from TIMESTAMP current_timestamp) - EXTRACT(EPOCH from TIMESTAMP updated_time) ::integer ERROR: syntax error at or near "current_timestamp" at character 37