Re: What Am I Doing Wrong?

From: "Lane Van Ingen" <lvaningen(at)esncc(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: What Am I Doing Wrong?
Date: 2005-10-18 21:20:25
Message-ID: EKEMKEFLOMKDDLIALABIAEPNCDAA.lvaningen@esncc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)esncc(dot)com]
Sent: Tuesday, October 18, 2005 3:39 PM
To: pgsql-sql(at)postgresql(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Judith Altamirano Figueroa 2005-10-18 23:03:59 query to file
Previous Message Lane Van Ingen 2005-10-18 19:38:54 What Am I Doing Wrong?