Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > convert Number to Date:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-09-08, 18:01
patdev patdev is offline
Registered User
 
Join Date: Jun 2005
Posts: 25
convert Number to Date:

Hi all,

i have column dataty with number and i would like to convert to date but not getting any success:

I have 20080625092308000 and would like to convert to 2008/06/25 and rest needs to be ignored:

Thanks
Pat
Reply With Quote
  #2 (permalink)  
Old 10-10-08, 02:00
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 2,715
With a little help of the SUBSTR and TO_DATE functions, you might do it as following:
Code:
SQL> select to_date(substr('20080625092308000', 1, 8), 'yyyy/mm/dd') result 2 from dual; RESULT ---------- 25.06.2008 SQL>
Reply With Quote
  #3 (permalink)  
Old 10-10-08, 09:22
patdev patdev is offline
Registered User
 
Join Date: Jun 2005
Posts: 25
thanks a lot for help
Reply With Quote
  #4 (permalink)  
Old 10-10-08, 10:03
beilstwh beilstwh is offline
Registered User
 
Join Date: Jun 2004
Location: Liverpool, NY USA
Posts: 1,642
Since it is a number, this would also work


Code:
select to_date(to_char(floor(20080625092308000/1000000000)), 1, 8), 'yyyymmdd') result from dual;
__________________
Bill
Cream always raises to the top, and so does the scum!!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On