pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
to_date confusion
5+ messages / 5 participants
[nested] [flat]

* to_date confusion
@ 2003-01-07 03:58 Richard Rowell <richard@rowell.info>
  2003-01-13 18:45 ` Re: to_date confusion Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Richard Rowell @ 2003-01-07 03:58 UTC (permalink / raw)
  To: pgsql-sql

I'm confused.  How do I get the integer 10102 to come in as the date
2002-01-01?

cmi=> select to_date('010102','MMDDYY');
  to_date   
------------
 2002-01-01
(1 row)

cmi=> select to_char(10102,'000000');
 to_char 
---------
  010102
(1 row)

cmi=> select to_date(to_char(10102,'000000'),'MMDDYY');
  to_date   
------------
 2010-01-10
(1 row)

TIA!




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: to_date confusion
  2003-01-07 03:58 to_date confusion Richard Rowell <richard@rowell.info>
@ 2003-01-13 18:45 ` Josh Berkus <josh@agliodbs.com>
  2003-01-13 18:45   ` Re: to_date confusion Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Josh Berkus @ 2003-01-13 18:45 UTC (permalink / raw)
  To: Richard Rowell <richard@rowell.info>; pgsql-sql

Richard,

> I'm confused.  How do I get the integer 10102 to come in as the date
> 2002-01-01?

Hmmm ... isn't this an old post, repeating?

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: to_date confusion
  2003-01-07 03:58 to_date confusion Richard Rowell <richard@rowell.info>
  2003-01-13 18:45 ` Re: to_date confusion Josh Berkus <josh@agliodbs.com>
@ 2003-01-13 18:45   ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Stephan Szabo @ 2003-01-13 18:45 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: Richard Rowell <richard@rowell.info>; pgsql-sql


On Mon, 13 Jan 2003, Josh Berkus wrote:

> Richard,
>
> > I'm confused.  How do I get the integer 10102 to come in as the date
> > 2002-01-01?
>
> Hmmm ... isn't this an old post, repeating?

Yep, my guess is that he sent it, wasn't on the list so it went for
approval, he joined and resent, and we're now getting the approved
version of it (given that I just received a bunch of messages
with dates about a week ago)






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* to_date() confusion
@ 2003-01-08 14:49 Richard Rowell <richard@bowmansystems.com>
  2003-01-08 15:06 ` Re: to_date() confusion Bruno Wolff III <bruno@wolff.to>
  0 siblings, 1 reply; 5+ messages in thread

From: Richard Rowell @ 2003-01-08 14:49 UTC (permalink / raw)
  To: pgsql-sql

I'm confused.  How do I massage the integer 10102 into the date
2002-01-01?

cmi=> select to_date('010102','MMDDYY');
  to_date   
------------
 2002-01-01
(1 row)

cmi=> select to_char(10102,'000000');
 to_char 
---------
  010102
(1 row)

cmi=> select to_date(to_char(10102,'000000'),'MMDDYY');
  to_date   
------------
 2010-01-10
(1 row)

TIA!

-- 
Richard Rowell <richard@bowmansystems.com>




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: to_date() confusion
  2003-01-08 14:49 to_date() confusion Richard Rowell <richard@bowmansystems.com>
@ 2003-01-08 15:06 ` Bruno Wolff III <bruno@wolff.to>
  0 siblings, 0 replies; 5+ messages in thread

From: Bruno Wolff III @ 2003-01-08 15:06 UTC (permalink / raw)
  To: Richard Rowell <richard@bowmansystems.com>; +Cc: pgsql-sql

On Wed, Jan 08, 2003 at 08:49:00 -0600,
  Richard Rowell <richard@bowmansystems.com> wrote:
> I'm confused.  How do I massage the integer 10102 into the date
> 2002-01-01?
> 
> cmi=> select to_char(10102,'000000');
>  to_char 
> ---------
>   010102
> (1 row)

Note the leading space in the returned row. That is probably what is making
the difference.  You probably want to use to_char(10102,'FM000000').



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-01-13 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07 03:58 to_date confusion Richard Rowell <richard@rowell.info>
2003-01-13 18:45 ` Josh Berkus <josh@agliodbs.com>
2003-01-13 18:45   ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2003-01-08 14:49 to_date() confusion Richard Rowell <richard@bowmansystems.com>
2003-01-08 15:06 ` Re: to_date() confusion Bruno Wolff III <bruno@wolff.to>

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