Oracle SQL “SELECT DATE from DATETIME field ”

后端 未结 3 711
耶瑟儿~
耶瑟儿~ 2021-02-08 01:18

I have field REPORTDATE (DATETIME). In SQL Developer i can see its value in this format

29.10.2013 17:08:08

I found that in order to do the select o

3条回答
  •  鱼传尺愫
    2021-02-08 01:55

    Use this:

    SELECT trunc(REPORTDATE, 'DD') AS my_date
    FROM TABLE1
    

    This will not change the type of the returning object, only truncates everything below "day" level.

    If you are ok with returning a String, then you can just do:

    SELECT TO_CHAR(REPORTDATE, 'DD.MM.YYYY') AS my_date
    FROM TABLE1
    

提交回复
热议问题