I can't seem to find any way to format a date field to be displayed like 25 DEC 08. The only format near this is myDate/DMTY which produces 25 DEC, 08. I know I can redefine and strip out the comma but I would there there is a standard formatting statement. Thanks for the help! EdThis message has been edited. Last edited by: Kerry,
764 MS PDF
September 29, 2008, 10:43 AM
FrankDutch
Ed
What is the internal format for this field? (the master file description?)
Do you have the proper manuals for converting fields?
There is a very good and cheap book than gives you almost 1001 formulas to convert and calculate with dates that you should buy.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
September 29, 2008, 10:51 AM
Francis Mariani
DEFINE FILE CAR
DATE0/A8YYMD = '20081225';
DATE1/DMTY = DATE0;
DATE2/A17 = CHGDAT('YYMD', 'DMTY', DATE0, 'A17');
END
TABLE FILE CAR
SUM
DATE1
DATE2
SALES
BY CAR
END
DATE1 is a normal date reformat which results in "25 DEC, 08". DATE2 uses the "legacy" Date Format Change CHGDAT function and results in "25 DEC 08".
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Thanks, that worked for me. I am a bit surprised that there is not a built in 'current' function to do this w/o having to use the legacy CYHGDAT.
764 MS PDF
September 30, 2008, 08:11 AM
Rick Man
Look at the DATETRAN function.
Reporting Server 7.6.10 Dev. Studio 7.6.8 Windows NT Excel, HTML, PDF
September 30, 2008, 09:24 AM
PBrightwell
You could put a define in you MFD using Francis' CHGDAT and then the format would be available anytime you used that file.
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
September 30, 2008, 10:22 AM
Francis Mariani
Rick man,
DATETRAN appears to have won the prize for most annoying syntax in a function. I can't get it to work. Would you be so kind as to give us an example of how to make this function output the requested date format?
This doesn't work:
DEFINE FILE CAR
DATE0/YYMD = DATECVT('20081225', 'A8YYMD', 'YYMD');
DATE1/A15 = DATETRAN(DATE0, '(MDYY)', '(BT)', 'EN', 15, 'A15');
END
TABLE FILE CAR
SUM
DATE0
DATE1
SALES
BY CAR
END
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Reporting Server 7.6.10 Dev. Studio 7.6.8 Windows NT Excel, HTML, PDF
October 01, 2008, 10:07 AM
Francis Mariani
Rick Man,
Thank you, but that results in "25-DEC-2008", not what EdG is looking for. He would like "25 DEC 08".
DATETRAN must be a commissioned function - written by a non-IBI programmer, it's the only way to explain why the syntax for this function is completely different than the other date functions. What are those brackets for? And, according to the manual, format option 'T' "Displays month as an abbreviated name with no punctuation, all uppercase." It doesn't state how to output the day and year.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
TABLE FILE CAR SUM DATE0 DATE1 DATE2 SALES BY CAR END
This returns
CAR DATE0 DATE1 DATE2 SALES
ALFA ROMEO 2008/12/25 25 DEC 08 25 Dec 08 30200
AUDI 2008/12/25 25 DEC 08 25 Dec 08 7800
BMW 2008/12/25 25 DEC 08 25 Dec 08 80390
BTW. the reason for being so weird is that it is the only date function that accomodates NLS for formatting. That doe not explain the need for the ()though.This message has been edited. Last edited by: <JG>,
October 01, 2008, 12:59 PM
Robert Freeman
Using the DMTY format with Legacy dates (I6DMTY) does not include the comma after the month. Simply convert the Smart Date to a Legacy date without the need for subroutines.
DEFINE FILE CAR
DATE0/YYMD='20081225';
DATE1/I6DMTY=DATE0;
END
TABLE FILE CAR
PRINT DATE0 DATE1
BY COUNTRY
END
COUNTRY DATE0 DATE1
------- ----- -----
ENGLAND 2008/12/25 25 DEC 08
FRANCE 2008/12/25 25 DEC 08
ITALY 2008/12/25 25 DEC 08
JAPAN 2008/12/25 25 DEC 08
W GERMANY 2008/12/25 25 DEC 08
Robert Freeman
FOCUS for VM 7.6.x
October 01, 2008, 01:40 PM
Francis Mariani
JG, thanks for the explanation. I finally get it.
The documentation seems a little unclear - it doesn't really suggest that the input type is also the output:
intype - Is one of the following character strings indicating the input date components and the order in which you want them to display, enclosed in parentheses and single quotation marks.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server