Received: from golem.jpl.nasa.gov (IDENT:root@hectic-1.jpl.nasa.gov [128.149.68.203]) by hub.org (8.9.2/8.9.1) with ESMTP id XAA79443 for ; Mon, 8 Mar 1999 23:16:11 -0500 (EST) (envelope-from lockhart@alumni.caltech.edu) Received: from alumni.caltech.edu (localhost [127.0.0.1]) by golem.jpl.nasa.gov (8.8.5/8.8.5) with ESMTP id EAA07389; Tue, 9 Mar 1999 04:15:59 GMT Sender: tgl@mythos.jpl.nasa.gov Message-ID: <36E4A07F.BFFC4480@alumni.caltech.edu> Date: Tue, 09 Mar 1999 04:15:59 +0000 From: "Thomas G. Lockhart" Organization: Caltech/JPL X-Mailer: Mozilla 4.07 [en] (X11; I; Linux 2.0.36 i686) MIME-Version: 1.0 To: Matthew Hagerty CC: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] [off topic] Date and time fields References: <4.1.19990308173042.009df880@mail.venux.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > Could someone give me a basic run down on how to use/do date and time > checking and comparing. For example, I want to know how long someone > is logged into my site, so each time they request a page I update a > "time" field in my table. How can I check to see if more than, say 5 > or 10 minutes has passed? I've come to learn that is *can't* be as > simple as something like this: > select * from temp > where (logintime + '10 minutes') < time 'now'::datetime; > > Also, what is the double colon? I only use it here because I saw it > used all over in the online docs. ;) The double colon notation is a Postgres-ism which in this context is leading to confusion. Use the SQL92-standard syntax as below. If "logintime" is updated at each page access (and is a "datetime" type) then your query select * from temp where (logintime + time '10 min') < datetime 'now'; should work to identify stale connections I would think. Feel free to ask other questions. Have you looked at the html or hardcopy chapter on data types? Not sure how many examples it has, but it does discuss some issues I would think... - Tom