simply declare your own function like this:
create function date_fmt(TS date, fmt varchar(30))
returns varchar(50)
return
with tmp (dd,mm,yyyy) as
(
select
substr( digits (day(TS)),9),
substr( digits (month(TS)),9) ,
rtrim(char(year(TS))) ,
from sysibm.sysdummy1
)
select
case fmt
when 'yyyymmdd'
then yyyy || mm || dd
when 'mm/dd/yyyy'
then mm || '/' || dd || '/' || yyyy
when '222'
then dd || '.' || mm || '.' || yyyy
else
'date format ' || coalesce(fmt,' ') ||
' not recognized.'
end
from tmp