pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
convert from an integer to a date
3+ messages / 3 participants
[nested] [flat]

* convert from an integer to a date
@ 2003-02-14 21:33  STashlitsky@JEFCO.com
  0 siblings, 2 replies; 3+ messages in thread

From: STashlitsky@JEFCO.com @ 2003-02-14 21:33 UTC (permalink / raw)
  To: pgsql-sql

When I run select to_date('20030212','YYYYMMDD') the output is 2/12/03
if I run select to_date( to_char(20030212,99999999),'YYYYMMDD'); the output is 6/23/05

How can I convert from integer into date format correctly?

Thanks for any help with this.

Svetlana




Jefferies archives and reviews outgoing and incoming e-mail.  It may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of  transmission. Use by other than intended recipients is prohibited.

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

* Re: convert from an integer to a date
@ 2003-02-17 19:52  Miquel van Smoorenburg <miquels@cistron-office.nl>
  parent: STashlitsky@JEFCO.com
  1 sibling, 0 replies; 3+ messages in thread

From: miquels@cistron-office.nl @ 2003-02-17 19:52 UTC (permalink / raw)
  To: pgsql-sql

In article <OFC94B0A45.89F8C8AE-ON85256CCD.0075A6DD@jc.jefco.com>,
 <STashlitsky@JEFCO.com> wrote:
>How can I convert from integer into date format correctly?

traffic=# select date(20030212);
    date    
------------
 2003-02-12
(1 row)

or

traffic=# select 20030212::text::date;
    date    
------------
 2003-02-12
(1 row)

Mike.
-- 
Anyone who is capable of getting themselves made President should
on no account be allowed to do the job -- Douglas Adams.




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

* Re: convert from an integer to a date
@ 2003-02-17 21:43  Frank Bax <fbax@sympatico.ca>
  parent: STashlitsky@JEFCO.com
  1 sibling, 0 replies; 3+ messages in thread

From: Frank Bax @ 2003-02-17 21:43 UTC (permalink / raw)
  To: pgsql-sql

At 04:33 PM 2/14/03, STashlitsky@JEFCO.com wrote:
>When I run select to_date('20030212','YYYYMMDD') the output is 2/12/03
>if I run select to_date( to_char(20030212,99999999),'YYYYMMDD'); the 
>output is 6/23/05
>
>How can I convert from integer into date format correctly?


Same as the first one, except leave out the quotes.
         select to_date(20030212,'YYYYMMDD');




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


end of thread, other threads:[~2003-02-17 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-14 21:33 convert from an integer to a date STashlitsky@JEFCO.com
2003-02-17 19:52 ` Miquel van Smoorenburg <miquels@cistron-office.nl>
2003-02-17 21:43 ` Frank Bax <fbax@sympatico.ca>

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