Skip site navigation (1) Skip section navigation (2)

Re: timestamps

From: Steven Klassen <sklassen(at)commandprompt(dot)com>
To: Martin Atukunda <matlads(at)myrealbox(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: timestamps
Date: 2004-12-14 16:35:11
Message-ID: 20041214163511.GA21117@commandprompt.com (view raw or flat)
Thread:
Lists: pgsql-novice
# The schema for translog is as follows:
# 
# CREATE TABLE translog (
#  id serial,
#  action integer,
#  sdate varchar(16) NOT NULL,
#  stime varchar(16) NOT NULL
# );

I assume you mean the composite sdate/stime is 1 minute ago?

Instead of storing separate date & time varchar fields, why don't you
store one timestamp field?  Then a query like this would work:

SELECT * FROM translog WHERE start <= (now() - '1 minute'::interval);

-- 
Steven Klassen - Lead Programmer
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564

In response to

  • timestamps at 2004-12-14 09:39:44 from Martin Atukunda

Responses

pgsql-novice by date

Next:From: Afton & Ray StillDate: 2004-12-14 21:32:41
Subject: Re: basic download and setup questions
Previous:From: Andreas KretschmerDate: 2004-12-14 10:15:38
Subject: Re: [despammed] timestamps

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group