Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1C248632AB4 for ; Sat, 17 Oct 2009 08:42:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 74077-02 for ; Sat, 17 Oct 2009 11:41:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ananke.wxnz.net (ananke.wxnz.net [58.28.4.122]) by mail.postgresql.org (Postfix) with ESMTP id 494236325F2 for ; Sat, 17 Oct 2009 08:41:52 -0300 (ADT) Received: from gonzo (ip-118-90-129-137.xdsl.xnet.co.nz [118.90.129.137]) by ananke.wxnz.net (Postfix) with ESMTP id 3825E1703E7 for ; Sun, 18 Oct 2009 00:41:48 +1300 (NZDT) Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1Mz7fP-0005Lv-NQ for pgsql-sql@postgresql.org; Sun, 18 Oct 2009 00:41:47 +1300 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: How to get the previous date? Date: 17 Oct 2009 11:41:47 GMT Organization: Dis (not Dat) Organisation Lines: 30 Message-ID: References: <6caee9520910140240u13daba93ua20637642727776e@mail.gmail.com> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1255779707 20577 127.0.0.1 (17 Oct 2009 11:41:47 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.185 tagged_above=-10 required=5 tests=BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 200910/63 X-Sequence-Number: 33262 On 2009-10-14, Shruthi A wrote: > --0016e64698e4af821f0475e1f43d > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I'm using Enterprise DB PostgresPlus version 8.3. > Is there is a simple function or command like previous_date(mydate) which > when passed a particular date, simply returns the previous date? I tried > > mydate - 1 > > but this doesnt work. it should, if mydate is a date variable. if it's some sort of timestamp more care is needed mytimestamp - interval'1 day' also don't use interval'24h' unless you want 24h, because not all days are 24h select timestamptz'2009-09-28 00:30' - interval'24 h' ; ?column? ------------------------ 2009-09-26 23:30:00+12 (the interval crosses the local start of DST)