IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    [SOLVED] Date format for DD MMM YY
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
EdG
Member
Posted
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
 
Posts: 3 | Registered: September 26, 2008Reply With QuoteEdit or Delete MessageReport This Post
Virtuoso
Posted Hide Post
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.5 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.5 on the same platform and databases,IE7

 
Posts: 1633 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
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
 
Posts: 3379 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteEdit or Delete MessageReport This Post
EdG
Member
Posted Hide Post
FIELDNAME=ACTIVITYDATE, ALIAS=activityDate, USAGE=YYMMD, ACTUAL=DATE, $


764 MS PDF
 
Posts: 3 | Registered: September 26, 2008Reply With QuoteEdit or Delete MessageReport This Post
EdG
Member
Posted Hide Post
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
 
Posts: 3 | Registered: September 26, 2008Reply With QuoteEdit or Delete MessageReport This Post
Silver Member
Posted Hide Post
Look at the DATETRAN function.


7.6.2
Windows NT
Excel, HTML, PDF
 
Posts: 42 | Registered: March 31, 2008Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
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
 
Posts: 524 | Location: TX | Registered: September 25, 2007Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
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
 
Posts: 3379 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteEdit or Delete MessageReport This Post
Guru
Posted Hide Post
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.
 
Posts: 342 | Location: Melbourne Australia | Registered: April 15, 2003Reply With QuoteEdit or Delete MessageReport This Post
Silver Member
Posted Hide Post
Try this:
DATE1/A11 = DATETRAN(DATE0, '(DMYY)', '(-T)', 'EN', 11, 'A11');


7.6.2
Windows NT
Excel, HTML, PDF
 
Posts: 42 | Registered: March 31, 2008Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
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
 
Posts: 3379 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteEdit or Delete MessageReport This Post
JG
Master
Posted Hide Post
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,
 
Posts: 930 | Registered: February 24, 2005Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
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
 
Posts: 4 | Registered: November 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
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
 
Posts: 3379 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    [SOLVED] Date format for DD MMM YY

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.