Re: Format date to MM/DD/YYYY
Hi,
Before you try all these more or less complicated solutions you already got, just a question. Where or how do you want to display dates?
If you are using interactive SQL (STRSQL), just do the following steps:
If you are working with iSeries Navigator's Run an SQL Script:
Other interfaces may have comparable possibilites to change the date format.
A date is always stored as 4 byte binary value repesenting the calculated days from 01/01/0001. A date format is used to make this cryptic date readable.
But the date separators for the predefined date formats ISO, USA, EUR and JIS are fixed and cannot be changed.
ISO: YYYY-MM-DD
USA: MM/DD/YYYY
EUR: DD.MM.YYYY
JIS: YYYY-MM-DD
I you really need to show the European date with slashes as separators, you have to convert the date into the character representation of the date and replace the date separators after:
Birgitta
Hi,
I'm doing a select mydate from whereever and dates are displayed as YYYY-MM-DD
If you are using interactive SQL (STRSQL), just do the following steps:
- Press F13=Services
- Select 1. Change Session Attributes
- Change the date format from *ISO to *EUR
If you are working with iSeries Navigator's Run an SQL Script:
- Click Connection
- Click JDBC-Setup
- Click Format
- Change the date format to the format you want
Other interfaces may have comparable possibilites to change the date format.
A date is always stored as 4 byte binary value repesenting the calculated days from 01/01/0001. A date format is used to make this cryptic date readable.
But the date separators for the predefined date formats ISO, USA, EUR and JIS are fixed and cannot be changed.
ISO: YYYY-MM-DD
USA: MM/DD/YYYY
EUR: DD.MM.YYYY
JIS: YYYY-MM-DD
I you really need to show the European date with slashes as separators, you have to convert the date into the character representation of the date and replace the date separators after:
PHP Code:
select translate(char(current_date, EUR), '/', '.')
from sysIbm/sysdummy1;






Comment