DB2 Dates format by region

To give a specific format to the date obtained throught DB2 “current date”, you can use the following method.

Get date with the European format:


select CHAR(current date, EUR) from sysibm.sysdummy1

1
----------
22.03.2012

1 record(s) selected.

Get date with the USA format:


db2 => select char(current date, USA) from sysibm.sysdummy1

1
----------
03/22/2012

1 record(s) selected.

Others formats:

USA Use the IBM standard for U.S. date and time format.
EUR Use the IBM standard for Europe date and time format.
DEF Use a date and time format associated with the territory code.
ISO Use the date and time format of the International Standards Organization.
JIS Use the date and time format of the Japanese Industrial Standard.
LOC Use the date and time format in local form associated with the territory code of the database.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Cookies use

This web uses cookies to enhance your user experience, collect anonymous usage statistics and integrate content from third-party services. If you continue browsing you are giving your consent for us to set cookies. More information.

ACEPTAR
Aviso de cookies