|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
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! Ed This message has been edited. Last edited by: kerry, 764 MS PDF |
||
|
|
Virtuoso |
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.
|
|||||||
|
|
Expert |
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 Env 1: WebFOCUS 5.3.2 Servlet - MRE/BID/Self Service/ReportCaster - MS Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server 2000 - DataMigrator 5.3.4 Env 2: WebFOCUS 7.6.5 Servlet - MRE/BID/Self Service - MS Windows XP SP2 - Apache Tomcat/5.5.25 - MS SQL Server 2000 Env 3: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2 Output formats: HTML, Excel 2000 and PDF |
|||
|
|
Member |
FIELDNAME=ACTIVITYDATE, ALIAS=activityDate, USAGE=YYMMD, ACTUAL=DATE, $
764 MS PDF |
|||
|
|
Member |
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 |
|||
|
|
Silver Member |
Look at the DATETRAN function.
7.6.2 Windows NT Excel, HTML, PDF |
|||
|
|
Master |
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 5.3.2 AIX, NT, AS/400, Focus AS/400, AIX, Oracle, JDE, DB2, Lotus Notes |
|||
|
|
Expert |
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 Env 1: WebFOCUS 5.3.2 Servlet - MRE/BID/Self Service/ReportCaster - MS Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server 2000 - DataMigrator 5.3.4 Env 2: WebFOCUS 7.6.5 Servlet - MRE/BID/Self Service - MS Windows XP SP2 - Apache Tomcat/5.5.25 - MS SQL Server 2000 Env 3: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2 Output formats: HTML, Excel 2000 and PDF |
|||
|
|
Guru |
This seemed to work for me in R766(win):
DATE1/A15 = DATETRAN(DATE0, '(DMY)', '(BT)', 'EN', 15, DATE1); ttfn, kp Access to most releases from R52x, on multiple platforms. |
|||
|
|
Silver Member |
Try this:
DATE1/A11 = DATETRAN(DATE0, '(DMYY)', '(-T)', 'EN', 11, 'A11'); 7.6.2 Windows NT Excel, HTML, PDF |
|||
|
|
Expert |
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 Env 1: WebFOCUS 5.3.2 Servlet - MRE/BID/Self Service/ReportCaster - MS Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server 2000 - DataMigrator 5.3.4 Env 2: WebFOCUS 7.6.5 Servlet - MRE/BID/Self Service - MS Windows XP SP2 - Apache Tomcat/5.5.25 - MS SQL Server 2000 Env 3: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2 Output formats: HTML, Excel 2000 and PDF |
|||
|
|
Master |
DEFINE FILE CAR
DATE0/YYMD = DATECVT('20081225', 'A8YYMD', 'YYMD'); DATE1/A15 = DATETRAN(DATE0, '(DMY)', '(BT)', 'EN', 15, 'A15'); DATE2/A15 = LCWORD(15,DATETRAN(DATE0, '(DMY)', '(BT)', 'EN', 15, 'A15'),'A15'); END 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, |
|||
|
|
Member |
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 |
|||
|
|
Expert |
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: DATETRAN (indate, '(intype)', '([formatops])', 'lang', outlen, 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 Env 1: WebFOCUS 5.3.2 Servlet - MRE/BID/Self Service/ReportCaster - MS Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server 2000 - DataMigrator 5.3.4 Env 2: WebFOCUS 7.6.5 Servlet - MRE/BID/Self Service - MS Windows XP SP2 - Apache Tomcat/5.5.25 - MS SQL Server 2000 Env 3: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2 Output formats: HTML, Excel 2000 and PDF |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

