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

Re: timestamps

From: Martin Atukunda <matlads(at)myrealbox(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: timestamps
Date: 2004-12-14 22:18:03
Message-ID: 200412150118.03979.matlads@myrealbox.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Tuesday 14 December 2004 19:35, Steven Klassen wrote:
> # 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);
Thanx this works!

- Martin -

In response to

pgsql-novice by date

Next:From: SamDate: 2004-12-15 00:02:23
Subject: tsearch2 installation problem
Previous:From: sarlav kumarDate: 2004-12-14 21:34:07
Subject: Query Optimization

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