Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Date Agony
 Login/Join
 
Master
posted
I'm stuck on date agony.

I have 3 fields: year/i4 month/i2 and day/i2.

How would you convert these fields into a single date string in yymd format?

Thank you

This message has been edited. Last edited by: FP Mod Chuck,


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
Virtuoso
posted Hide Post
FULL_DATE/A8YYMD=EDIT(YEAR)|EDIT(MONTH)|EDIT(DAY);


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
FULL_DATE/I8YYMD=YEAR * 10000 + MONTH * 100 + DAY;


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Master
posted Hide Post
Expanding on MartinY's answer. To get a smart date:
FULLDATE/YYMD=DATECVT(YEAR*10000+MONTH*100+DAY,'I8YYMD','YYMD');


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Master
posted Hide Post
Expanding on BabakNYC's answer. To get a smart date: Wink
 DATE_YYMD/YYMD = DATECVT(EDIT(YEAR)|EDIT(MONTH)|EDIT(DAY),'A8YYMD','YYMD'); 
Smart dates are actually pretty easy to work with once you know that the date is just an integer that is an offset of the number of days since 12/31/1900. This means that the integer 1 = 1/1/1901, 2 = 1/2/1901, 43037 = 10/30/2018, etc.

Incrementing smart dates is really easy. All you need to do is add or subtract the number of days you need. Run the fex below to see some examples of different date formats.
  
DEFINE FILE CAR
YEAR/I4  = DTPART('&YYMD', YEAR);
MONTH/I2 = DTPART('&YYMD', MONTH);
DAY/I2   = DTPART('&YYMD', DAY);

-*ALPHA CONVERSION 
DATE1_A8/A8 = EDIT(YEAR)|EDIT(MONTH)|EDIT(DAY);
DATE1_A8YYMD/A8YYMD = EDIT(YEAR)|EDIT(MONTH)|EDIT(DAY);
DATE1_YYMD/YYMD = DATECVT(EDIT(YEAR)|EDIT(MONTH)|EDIT(DAY),'A8YYMD','YYMD'); -* <-- SMART DATE

-*INTEGER CONVERSION 
DATE2_I8/I8 = YEAR * 10000 + MONTH * 100 + DAY;
DATE2_I8YYMD/I8YYMD = YEAR * 10000 + MONTH * 100 + DAY;
DATE2_YYMD/YYMD = DATECVT(YEAR * 10000 + MONTH * 100 + DAY,'I8YYMD','YYMD'); -* <-- SMART DATE

SMART_DATE_DAY1/I1 = 1;
BREAK/A15 = 'Converted Date'; 
END
 
TABLE FILE CAR
PRINT YEAR
OVER MONTH
OVER DAY

OVER BREAK AS 'Alpha Conversion'
OVER DATE1_A8
OVER DATE1_A8YYMD
OVER DATE1_YYMD

OVER BREAK AS 'Integer Conversion'
OVER DATE2_I8
OVER DATE2_I8YYMD
OVER DATE2_YYMD

OVER COMPUTE SDATE/A50V = 'Smart<br>Date'; AS 'Smart Date<br>Examples' 
     COMPUTE DESC/A50V = '# Days After<br>12/31/1900'; AS ''
OVER SMART_DATE_DAY1/YYMD AS 'Smart Date Day 1'
     SMART_DATE_DAY1/I1 AS ''
OVER DATE2_YYMD/YYMD AS 'Today''s Date'
     DATE2_YYMD/I11 AS '' 
OVER COMPUTE DATE_YYMD_PLUS7/YYMD = DATE2_YYMD + 7; AS 'Today''s Date + 7'
     COMPUTE DATE_YYMD_PLUS7/I11  = DATE2_YYMD + 7; AS ''
BY COUNTRY NOPRINT
HEADING
"Today's Date: &DATEMDYY"
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT=CALIBRI, GRID=OFF, $
TYPE=TITLE, COLUMN=P4,  BACKCOLOR=SILVER, STYLE=Bold, $
TYPE=DATA , COLUMN=P4,  BACKCOLOR=SILVER, STYLE=Bold, $
TYPE=TITLE, COLUMN=P8,  BACKCOLOR=SILVER, STYLE=Bold, $
TYPE=DATA , COLUMN=P8,  BACKCOLOR=SILVER, STYLE=Bold, $
TYPE=TITLE, COLUMN=P12, BACKCOLOR=SILVER, STYLE=Bold, $
TYPE=DATA , COLUMN=P12, BACKCOLOR=SILVER, STYLE=Bold, $
TYPE=DATA , COLUMN=P13, BACKCOLOR=SILVER, STYLE=Bold, $
TYPE=HEADING, STYLE=Bold, $
ENDSTYLE
END

-HTMLFORM BEGIN 
<style>
    table {border-collapse: collapse; }
</style>
-HTMLFORM END

This message has been edited. Last edited by: Hallway,


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Master
posted Hide Post
Thanks Hallway.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders