pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: memnik@hotmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16238: Function " to_char(timestamp, text) " doesn't work properly
Date: Thu, 30 Jan 2020 13:48:23 +0100
Message-ID: <20200130124823.GA7512@depesz.com> (raw)
In-Reply-To: <16238-3008a3b37b41cb0e@postgresql.org>
References: <16238-3008a3b37b41cb0e@postgresql.org>

On Thu, Jan 30, 2020 at 11:49:45AM +0000, PG Bug reporting form wrote:
> For example this query "
> select to_char('2020-01-29'::date,'Day') " give me this result "Wednesday",
> but this query " select to_char('2020-01-31'::date,'Day') "  give me this
> result "Friday   ".
> So, i guess it is not right to have days with many spaces as a result and
> some days without any space.

First of all - it's not a bug - function works exactly as documented:
https://www.postgresql.org/docs/current/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIME-TABL...
says:

"Day" -> full capitalized day name (blank-padded to 9 chars).

If you don't want the padding, use FM modifier, like:

select to_char('2020-01-31'::date,'FMDay');

Best regards,

depesz






view thread (4+ messages)  latest in thread

Message-ID: <20200130124823.GA7512@depesz.com>
Permalink:  ../20200130124823.GA7512@depesz.com/
Also on:    postgresql.org/message-id/20200130124823.GA7512@depesz.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: depesz@depesz.com, memnik@hotmail.com
  Subject: Re: BUG #16238: Function " to_char(timestamp, text) " doesn't work properly
  In-Reply-To: <20200130124823.GA7512@depesz.com>
  References: <16238-3008a3b37b41cb0e@postgresql.org> <20200130124823.GA7512@depesz.com>

* 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