Change date format DB2 from YYYYMMDD to MM/DD/YYYY

==============================================
Module : To get date format for DB2 Date
Programmer : Mohd Izzairi Yamin
Date : 31/03/2008 15:36
==============================================

# DB2 Date Format :
2008-03-24 16:38:58.623431

Lets say, the Field that stores the date is in db2 time stamp format and you want to format it , you can use this simple way to solve that :

Example 1

select Year (DATEFIELD) from TABLENAME
select Month (DATEFIELD) from TABLENAME
select day (DATEFIELD) from TABLENAME

Example 2

select Year(FDTARIKH),MONTH(FDTARIKH),day(FDTARIKH) from TBLOGLOGIN


About this entry