How to get current date with format YYYYMMSS in DB2??

To get the current date, time, and timestamp using SQL in DB2, reference to use below sql statment
db2 => select current date from sysibm.sysdummy1

1
----------
08/29/2013

1 record(s) selected.

db2 => select current time from sysibm.sysdummy1

1
--------
16:59:01

1 record(s) selected.

db2 => select current timestamp from sysibm.sysdummy1

1
--------------------------
2013-08-29-16.37.35.960388

1 record(s) selected.


How to custom date/time formatting?
The easy way to do this is use VARCHAR_FORMATscalar function
db2 => select varchar_format(current timestamp, 'YYYYMMDD') from sysibm.sysdummy1

1

-----------------------------------
20130829

1 record(s) selected.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 mark528 的頭像
    mark528

    狐的窩

    mark528 發表在 痞客邦 留言(0) 人氣()