pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: john whale <john.whale@ukdirect.org>
Cc: 'pgsql-sql@postgreSQL.org' <pgsql-sql@postgresql.org>
Subject: Re: DATE
Date: Wed, 24 Jan 2001 10:54:35 +0000
Message-ID: <200101241054.f0OAsdq20101@linda.lfix.co.uk> (raw)
In-Reply-To: <john.whale@ukdirect.org> <07EB26C562C6D411ACE900C04FA33F8F5438@UKMAIL>

john whale wrote:
  >PLEASE ADVISE HOW I SHOULD ALTER THE COMMAND:
  >
  ><$NOW;DDMMMM;YYYY>
  >
  >TO GIVE ME A DATE THAT IS X DAYS FORWARD
  >
  >ie:  I WISH TO REPRESENT A DATE IN FORM WHICH IS A 7 DAYS FORWARD
  >OF THE DATE NOW.

I don't recognise the format you are using, but in standard SQL:

template1=# select CURRENT_DATE as now,
template1-#        CAST (CURRENT_DATE + INTERVAL '7 days' AS DATE) as week;
    now     |    week    
------------+------------
 2001-01-24 | 2001-01-31
(1 row)

Use to_char() for date formatting.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "If anyone has material possessions and sees his
      brother in need but has no pity on him, how can the
      love of God be in him?"
                                    I John 3:17 





view thread (20+ messages)  latest in thread

Message-ID: <200101241054.f0OAsdq20101@linda.lfix.co.uk>
Permalink:  ../200101241054.f0OAsdq20101@linda.lfix.co.uk/
Also on:    postgresql.org/message-id/200101241054.f0OAsdq20101@linda.lfix.co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: olly@lfix.co.uk, john.whale@ukdirect.org
  Subject: Re: DATE
  In-Reply-To: <200101241054.f0OAsdq20101@linda.lfix.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox