pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Osvaldo Rosário Kussama <osvaldo_kussama@yahoo.com.br>
To: pgsql-sql@postgresql.org
To: superboy143@gmail.com
Subject: Re: date
Date: Fri, 10 Feb 2006 16:07:52 +0000
Message-ID: <43ECBA58.3060303@yahoo.com.br> (raw)
In-Reply-To: <2865031.post@talk.nabble.com>
References: <2865031.post@talk.nabble.com>

superboy143 (sent by Nabble.com) wrote:

>Hello,
>
>How can I write an sql query in postgresql so that I can insert a date into
>a table in the format DD-MM-YYYY, and when I select the date from the table
>I should get the date in the same format.
>  
>

See postgresql.conf documentation
(http://www.postgresql.org/docs/8.1/interactive/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORM...):
17. Server Configuration
17.10.2. Locale and Formatting

DateStyle = 'German, dmy'
- output format specification: German
- input/output specification for year/month/day ordering: DMY


postgres=# SHOW datestyle;
  DateStyle
-------------
 German, DMY
(1 row)

postgres=# SELECT CURRENT_DATE;
    date
------------
 10.02.2006
(1 row)

postgres=# SELECT to_char('09/03/2005'::date,'dd/mon/yyyy');
   to_char
-------------
 09/mar/2005
(1 row)

[]s
Osvaldo



		
_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora!
http://br.acesso.yahoo.com



view thread (20+ messages)  latest in thread

Message-ID: <43ECBA58.3060303@yahoo.com.br>
Permalink:  ../43ECBA58.3060303@yahoo.com.br/
Also on:    postgresql.org/message-id/43ECBA58.3060303@yahoo.com.br

 · 

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: osvaldo_kussama@yahoo.com.br, superboy143@gmail.com
  Subject: Re: date
  In-Reply-To: <43ECBA58.3060303@yahoo.com.br>

* 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