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.
- Aug 29 Thu 2013 17:19
DB2: Get current date with format YYYYMMDD
全站熱搜
留言列表