Selecting by date (timestamp)

--0-1781307543-1141083974=:27486
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

I have the following table running on postgres 8.04:

CREATE TABLE ValueLog
(
idValueLog int4 NOT NULL DEFAULT nextval ('public.idValueLog_seq'::=
text),
PPx integer,
iValue integer DEFAULT -1,
fValue real DEFAULT -1,
t_tag timestamp without time zone,
t_arr timestamp without time zone,
cot integer,
ack boolean,
blk boolean,
qd_iv boolean,
qd_nt boolean,
qd_sb boolean,
qd_bl boolean,
qd_ov boolean,
CONSTRAINT idValueLog PRIMARY KEY (idValueLog)
)
WITHOUT OIDS;
ALTER TABLE ValueLog OWNER TO $admin_user;"

I've created the following SQL statement to select the records newer then=
a given date:

select almvalue.almname , ppoint.ppdimstr, valuelog.ack, valuelog.blk, to=
_char(valuelog.t_arr,'DD.MM.YYYY HH24:MI:SS') from ppoint, valuelog, almv=
alue where ppoint.ppx =3D valuelog.ppx and almvalue.almvalue =3D valuelog=
..ivalue and valuelog.ppx =3D $db_ppx and to_char(valuelog.t_arr,'YYYYMMD=
D') >=3D '$ts

$ts is a string, the date value input by the user and formated YYYYMMDD

I've developed the web site on my Ubuntu box, but when I uploaded the sit=
e on the server Fedora Core 3, I had problems with the date filtering. Ru=
nning psql on the server I've noticed that there were more data in the se=
lect * from value log results, field t_arr something like MM-DD-YYYY-dsf=
sdfd (something else which I don't know what it is)
I think that the local time settings on the server makes me the troubles.

What's the solution?

What's the best way to do filtering (selecting) data by time?

TIA, Jovan

=09
---------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.
--0-1781307543-1141083974=:27486
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,<br><br>I have the following table running on postgres 8.04:<br><br>&n=
bsp;  CREATE TABLE ValueLog <br>    ( <br>  =
;    idValueLog int4 NOT NULL DEFAULT nextval ('public.idV=
alueLog_seq'::text), <br>      PPx integer, <br>=
      iValue integer DEFAULT -1, <br>  =
;    fValue real DEFAULT -1, <br>    &=
nbsp; t_tag timestamp without time zone, <br>    &nbs=
p; t_arr timestamp without time zone, <br>      =
cot integer, <br>      ack boolean, <br> &n=
bsp;    blk boolean, <br>      qd=
_iv boolean, <br>      qd_nt boolean, <br> =
     qd_sb boolean, <br>     =
; qd_bl boolean, <br>      qd_ov boolean, <br>&n=
bsp;     CONSTRAINT
idValueLog PRIMARY KEY (idValueLog) <br>    ) <br> &=
nbsp;      WITHOUT OIDS; <br>     =
;   ALTER TABLE ValueLog OWNER TO $admin_user;" <br><br>I've cr=
eated the following SQL statement to select the records newer then a give=
n date:<br><br>select almvalue.almname , ppoint.ppdimstr, valuelog.ack, v=
aluelog.blk, to_char(valuelog.t_arr,'DD.MM.YYYY HH24:MI:SS') from ppoint,=
valuelog, almvalue where ppoint.ppx =3D valuelog.ppx and almvalue.almval=
ue =3D valuelog.ivalue and valuelog.ppx =3D $db_ppx and  to_char(val=
uelog.t_arr,'YYYYMMDD') >=3D '$ts<br><br>$ts is a string, the date val=
ue input by the user and formated YYYYMMDD<br><br>I've developed the web =
site on my Ubuntu box, but when I uploaded the site on the server Fedora =
Core 3, I had problems with the date filtering. Running psql on the serve=
r I've noticed that there were more data in the select * from  value=
log results, field t_arr something like
MM-DD-YYYY-dsfsdfd (something else which I don't know what it is)<br>I t=
hink that the local time settings on the server makes me the troubles.<br=
><br>What's the solution?<br><br>What's the best way to do filtering (sel=
ecting) data by time?<br><br>TIA, Jovan<br><p>
<hr size=3D1>Yahoo! Mail<br>
Bring photos to life! <a href=3D"http://pa.yahoo.com/*http://us.rd.yahoo.=
com/evt=3D39174/*http://photomail.mail.yahoo.com">New PhotoMail </a> make=
s sharing a breeze.

--0-1781307543-1141083974=:27486--
Jovan Kostovski [ Di, 28 Februar 2006 00:46 ] [ ID #1209669 ]
Datenbanken » gmane.comp.db.postgresql.php » Selecting by date (timestamp)

Vorheriges Thema: selecting records by timestamp (date)
Nächstes Thema: postgresql 7.3 php transaction problem