茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1729867 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00049.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

DB研討會 : [轉貼]Oracle Conver Date to String

發表者 討論內容
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15773
[轉貼]Oracle how to convert date to number
how to convert date to number
Srikkanth.M 2010/7/13 上午 8:47
Hai

How to convert the given date into number.

Thanks & regards



正確答案 建立者: Saubhik 在 2010/7/13 上午 11:05
Look at these posts
Please help me in Converting Lilian Format to Date
converstion to date
and try something like this.
SELECT sysdate,sysdate-to_date('15-10-1582','DD-MM-YYYY') lilian_dt FROM dual;




Prathamesh 2010/7/13 上午 8:49 (回應 Srikkanth.M)
    select to_number(to_char(sysdate, 'j')) from dual




Lakmal Rajapakse 2010/7/13 上午 8:51 (回應 Srikkanth.M)
By number do you mean change it to Julian date?
    select to_number(to_char(sysdate, 'J')) from dual;




Hoek 2010/7/13 上午 8:52 (回應 Srikkanth.M)
Use TO_CHAR first and apply your desired format mask:
    SQL> select to_number(to_char(sysdate, 'yyyymmddhh24miss')) from dual;

    TO_NUMBER(TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'))
    ----------------------------------------------
                                    20100713105102

    1 row selected.

    SQL>  select to_number(to_char(sysdate, 'yyyymmdd')) from dual;

    TO_NUMBER(TO_CHAR(SYSDATE,'YYYYMMDD'))
    --------------------------------------
                                  20100713

    1 row selected.




Saubhik 2010/7/13 上午 11:05 (回應 Srikkanth.M)
Look at these posts
Please help me in Converting Lilian Format to Date
converstion to date
and try something like this.
    SELECT sysdate,sysdate-to_date('15-10-1582','DD-MM-YYYY') lilian_dt FROM dual;


原文出處:how to convert date to number | Oracle Community
前一個主題 | 下一個主題 | | | |

討論串




Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|