Is it not datestyle that determines date format output?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Netto

    Is it not datestyle that determines date format output?

    The way PostgreSQL deals with the date format is confusing me...
    I need PostgreSQL to return dates from selects at this format: "dd/mm/yyyy",
    but it insists in returning it as "yyyy-mm-dd". I say "insists" cause I had
    already set datestyle to "European" (in postgresql.conf ) which represents
    the format I want... I checked it executing: "SHOW DATESTYLE" and I got:
    DateStyle
    -----------
    ISO with European conventions

    When inserting dates, PostgreSQL understands very well my date format like
    "dd/mm/yyyy", but it is also important to get the date like that.
    I think it's possible, but I had tried all the tricks I knew or I could
    retrieve from manual...

    Any ideas?
    Thank you all.
    Netto



  • Martijn van Oosterhout

    #2
    Re: Is it not datestyle that determines date format output?

    Check the datestyle settings in the manual. Also look at to_char, with that
    you can format the data any way you like,

    Maybe: set DateStyle = sql,european;

    On Thu, Dec 11, 2003 at 03:35:39PM -0200, Netto wrote:[color=blue]
    > The way PostgreSQL deals with the date format is confusing me...
    > I need PostgreSQL to return dates from selects at this format: "dd/mm/yyyy",
    > but it insists in returning it as "yyyy-mm-dd". I say "insists" cause I had
    > already set datestyle to "European" (in postgresql.conf ) which represents
    > the format I want... I checked it executing: "SHOW DATESTYLE" and I got:
    > DateStyle
    > -----------
    > ISO with European conventions
    >
    > When inserting dates, PostgreSQL understands very well my date format like
    > "dd/mm/yyyy", but it is also important to get the date like that.
    > I think it's possible, but I had tried all the tricks I knew or I could
    > retrieve from manual...
    >
    > Any ideas?
    > Thank you all.
    > Netto
    >
    >
    >
    >
    > ---------------------------(end of broadcast)---------------------------
    > TIP 8: explain analyze is your friend[/color]

    --
    Martijn van Oosterhout <kleptog@svana. org> http://svana.org/kleptog/[color=blue]
    > (... have gone from d-i being barely usable even by its developers
    > anywhere, to being about 20% done. Sweet. And the last 80% usually takes
    > 20% of the time, too, right?) -- Anthony Towns, debian-devel-announce[/color]

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.0.6 (GNU/Linux)
    Comment: For info see http://www.gnupg.org

    iD8DBQE/3ij3Y5Twig3Ge+Y RAhw1AJ9As1IVgB ioKHy2N2uOY1PMl wNlqwCg1iJo
    CjBcWBNo1uwN/IdSTpqPk7Q=
    =iu2n
    -----END PGP SIGNATURE-----

    Comment

    • scott.marlowe

      #3
      Re: Is it not datestyle that determines date format output?

      On Thu, 11 Dec 2003, Netto wrote:
      [color=blue]
      > The way PostgreSQL deals with the date format is confusing me...
      > I need PostgreSQL to return dates from selects at this format: "dd/mm/yyyy",
      > but it insists in returning it as "yyyy-mm-dd". I say "insists" cause I had
      > already set datestyle to "European" (in postgresql.conf ) which represents
      > the format I want... I checked it executing: "SHOW DATESTYLE" and I got:
      > DateStyle
      > -----------
      > ISO with European conventions
      >
      > When inserting dates, PostgreSQL understands very well my date format like
      > "dd/mm/yyyy", but it is also important to get the date like that.
      > I think it's possible, but I had tried all the tricks I knew or I could
      > retrieve from manual...[/color]

      This may be a dup (it arrived in my inbox on 11 Dec 2003), but I'll reply
      just in case.

      What flavor of Postgresql are you running? I'll assume 7.4.

      I'm assuming you've read this section of the docs:

      8.5.&nbsp;Date/Time Types # 8.5.1. Date/Time Input 8.5.2. Date/Time Output 8.5.3. Time Zones 8.5.4. Interval Input 8.5.5. Interval Output PostgreSQL supports …


      Have you tried entering:

      set DateStyle='SQL, dmy';

      ISO style makes it the yyyy-mm-dd format, SQL makes it the other.


      ---------------------------(end of broadcast)---------------------------
      TIP 5: Have you checked our extensive FAQ?



      Comment

      • Netto

        #4
        Re: Is it not datestyle that determines date format output?

        ""scott.marlowe "" <scott.marlowe@ ihs.com> escreveu na mensagem
        news:Pine.LNX.4 .33.03121607341 10.5679-100000@css120.i hs.com...
        [color=blue]
        >This may be a dup (it arrived in my inbox on 11 Dec 2003), but I'll reply
        >just in case.
        >What flavor of Postgresql are you running? I'll assume 7.4.
        >I'm assuming you've read this section of the docs:
        >http://www.postgresql.org/docs/curre...-datetime.html
        >Have you tried entering:
        >set DateStyle='SQL, dmy';
        >ISO style makes it the yyyy-mm-dd format, SQL makes it the other.[/color]

        Hey Scott,... thank you for the tips,... I forgot mentioning the PostgreSQL
        version I'm using... its 7.3.2. I read the documentation section you
        suggested, and it really solves my problem, since I upgrade postgresql to
        7.4.

        Netto


        Comment

        Working...