Hi All,
I have a written function which converts the date into various formats based on the input parameter.
DEFINE FUNCTION DATEFMT(INDATE/MDYY, FMT/I1)
DATEFMT/A20 = IF FMT EQ 1 THEN DATETRAN(INDATE, '(MDYY)', '(/)', 'EN', 15, 'A15')
ELSE IF FMT EQ 2 THEN DATETRAN(DATECVT(INDATE, 'MDYY', 'DMYY'), '(DMYY)', '(/)', 'EN', 15, 'A15')
ELSE IF FMT EQ 3 THEN DATETRAN(INDATE, '(MDYY)', '(-)', 'EN', 15, 'A15')
ELSE IF FMT EQ 4 THEN DATETRAN(DATECVT(INDATE, 'MDYY', 'DMYY'), '(DMYY)', '(-)', 'EN', 15, 'A15')
ELSE IF FMT EQ 5 THEN DATETRAN(DATECVT(INDATE, 'MDYY', 'DMYY'), '(DMYY)', '(TRD)', 'EN', 20, 'A20')
ELSE IF FMT EQ 6 THEN DATETRAN(DATECVT(INDATE, 'MDYY', 'DMYY'), '(DMYY)', '(Btr)', 'EN', 20, 'A20')
ELSE IF FMT EQ 7 THEN DATETRAN(DATECVT(INDATE, 'MDYY', 'DMYY'), '(DMYY)', '(.)', 'EN', 15, 'A15')
ELSE IF FMT EQ 8 THEN DATETRAN(DATECVT(INDATE, 'MDYY', 'DMYY'), '(DMYY)', '(-dm)', 'EN', 15, 'A15')
ELSE IF FMT EQ 9 THEN DATETRAN(DATECVT(INDATE, 'MDYY', 'YYMD'), '(YYMD)', '(-)', 'EN', 20, 'A20');
END
And am using this function in the proc as follows.
TABLE FILE CAR
PRINT
COMPUTE DUMMY/MDYY = 08152000; AS 'ORIGINAL,DATE,(MM/DD/YYYY)'
COMPUTE DUMMY2/A20=DATEFMT(DUMMY, 2); AS ',,(DD/MM/YYYY)'
COMPUTE DUMMY3/A20=DATEFMT(DUMMY, 3); AS ',,(MM-DD-YYYY)'
COMPUTE DUMMY4/A20=DATEFMT(DUMMY, 4); AS ',,(DD-MM-YYYY)'
COMPUTE DUMMY5/A20=DATEFMT(DUMMY, 5); AS ',,(DD-MONTH-YYYY)'
COMPUTE DUMMY6/A20=DATEFMT(DUMMY, 6); AS ',,(DD Month YYYY)'
COMPUTE DUMMY7/A20=DATEFMT(DUMMY, 7); AS ',,(DD.MM.YYYY)'
COMPUTE DUMMY8/A20=DATEFMT(DUMMY, 8); AS ',,(dD-mM-YYYY)'
COMPUTE DUMMY9/A20=DATEFMT(DUMMY, 9); AS ',,(YYYY-MM-DD)'
BY CAR NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE SET ONLINE-FMT PDF
ON TABLE SET STYLE *
TYPE=REPORT, SIZE=6,$
TYPE=REPORT, COLUMN = 'C1', SQUEEZE=0.7,$
TYPE=REPORT, COLUMN = 'C2', SQUEEZE=0.7,$
TYPE=REPORT, COLUMN = 'C3', SQUEEZE=0.7,$
TYPE=REPORT, COLUMN = 'C4', SQUEEZE=0.7,$
TYPE=REPORT, COLUMN = 'C5', SQUEEZE=0.8,$
TYPE=REPORT, COLUMN = 'C6', SQUEEZE=0.8,$
TYPE=REPORT, COLUMN = 'C7', SQUEEZE=0.7,$
TYPE=REPORT, COLUMN = 'C8', SQUEEZE=0.7,$
TYPE=REPORT, COLUMN = 'C9', SQUEEZE=0.7,$
ENDSTYLE
END
Problem is Year part is not properly displayed. it is displayed as -00ø0.
If the year is other than 2000 it displays the result without any problem.
Can anyone confirm whether I am doing wrong or it is a known problem.
Thanks all in advance.
Regards,
Kasi Krishnan
WF 7.1.4 & WF 7.6.9: Databases - DB2, SQL Server 2000.
OS: Windows & AIX