Thread: convert from an integer to a date

convert from an integer to a date

From
STashlitsky@JEFCO.com
Date:
<br /><font face="sans-serif" size="2">When I run </font><font color="blue" face="MS Sans Serif"
size="1">select</font><fontface="MS Sans Serif" size="1"> to_date('20030212','YYYYMMDD') the output is
2/12/03</font><br/><font face="MS Sans Serif" size="1">if I run </font><font color="blue" face="MS Sans Serif"
size="1">select</font><fontface="MS Sans Serif" size="1"> to_date( to_char(20030212,99999999),'YYYYMMDD'); the output
is6/23/05</font><br /><br /><font face="MS Sans Serif" size="1">How can I convert from integer into date format
correctly?</font><br/><br /><font face="MS Sans Serif" size="1">Thanks for any help with this.</font><br /><br /><font
face="MSSans Serif" size="1">Svetlana</font><br /><br /><font color="#000000" face="Helv" size="3"></font><br /><font
color="#000000"face="Helv" size="3"></font><br /><font color="#000000" face="Helv" size="3"></font><br /><font
color="#000000"face="Helv" size="3">Jefferies archives and reviews outgoing and incoming e-mail. It may be produced at
therequest of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or
omissionsarising as a result of transmission. Use by other than intended recipients is prohibited.</font><br /> 

Re: convert from an integer to a date

From
Frank Bax
Date:
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');



Re: convert from an integer to a date

From
miquels@cistron-office.nl (Miquel van Smoorenburg)
Date:
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.