However, i can't find any explicit date types or date format that allowing
me
to do so. Thus, is there any simple way to retrieve the date from the
database
with usered defined format?
thx a lot
chanr
select char(datecolumn,ISO)
returns date in ISO format (1999-11-21)
select char(datecolumn,USA)
return date in US format (11/22/1999)
See manual for more options (EUR etc.)
thx a lot!
Jani Patanen <Jani.Patan...@kolumbus.fi> wrote in message
news:3838F2A0...@kolumbus.fi...
DB2 does not a built-in date format that consists of mm/yyyy. However,
you can derive the date in that format by using a combination of
built-in functions, like so:
SELECT SUBSTR(CHAR(MY_DATE, ISO), 6, 2) CONCAT
'/' CONCAT
SUBSTR(CHAR(MY_DATE, ISO), 1, 4)
FROM CREATOR.TABLE;
This method assumes that the column you are selecting from has the DATE
data type, and that it is being returned to your program in ISO format;
that is, 'YYYY-MM-DD'.
Hope this helps.
Eddie White, Volvo IT North America
--
You can't be a nonconformist if you don't wear the
right uniform.
"And the Devil Will Drag You Under"
Jack L. Chalker
Sent via Deja.com http://www.deja.com/
Before you buy.
chanr wrote:
> In the DB2 database, there is a date column which format is dd/mm/yyyy,
> and i want to select a recordset with the format (dd/yyyy) of that column.
>
> However, i can't find any explicit date types or date format that allowing
> me
> to do so. Thus, is there any simple way to retrieve the date from the
> database
> with usered defined format?
>
> thx a lot
>
> chanr
Eddie White <eddie...@hotmail.com> wrote in message
news:81biaf$us9$1...@nnrp1.deja.com...
> In article <81b2fv$4u...@imsp212.netvigator.com>,
> "fatball" <ch...@cimse.com> wrote:
> > However, i can't find any example that showing the date with the
> format
> > consisting of month and year only.
> > Can u should me the sample sql statement, please?
> >
> > thx a lot!
> >
> > Jani Patanen <Jani.Patan...@kolumbus.fi> wrote in message
> > news:3838F2A0...@kolumbus.fi...
> > >
> > > > to do so. Thus, is there any simple way to retrieve the date from
> the
> > > > database
> > > > with usered defined format?
> > >