Focal Point
Compare Date Formats HYYMD to YYMD

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4421026272

February 20, 2008, 01:50 PM
Kymber
Compare Date Formats HYYMD to YYMD
I am trying to do a date comparision to see how many days have elapsed.
I have on date called FSTSTDT that is in format HYYMD
I have another date called CURRDATE that is in format YYMD

How do I convert FSTSTDT to YYMD so I can subtract the two dates from each other?

I already tried setting FSTSTDT to a new variable called
FDATE/YYMD = FSTSTDT
and this doesn't work.

Suggestions?
February 20, 2008, 02:14 PM
jimster06
In the upper right hand of this screen, you can click on Search the Technical Documentation Library. Search for HDATE.

There is also a very good book available about date handling.

HTH


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
February 20, 2008, 02:41 PM
Francis Mariani
Here's a quick example on how to convert a HYYMD date to YYMD using the HDATE function:

-SET &ECHO=ALL;

-SET &CURR_DATE = &YYMD;
-SET &CURR_TIME = EDIT(HHMMSS('A8'),'99$99$99');

-SET &CURR_DTTM = &CURR_DATE | &CURR_TIME;

DEFINE FILE CAR
CURR_DATE/HYYMD WITH MODEL = HINPUT(14, '&CURR_DTTM', 8, 'HYYMD');
END

TABLE FILE CAR
PRINT
CURR_DATE           

COMPUTE CURR_YYMD/YYMD = HDATE(CURR_DATE, 'YYMD'); 
WHERE RECORDLIMIT EQ 1
END
-RUN

(The DEFINE in this program simply creates a HYYMD date, since there is no real date field in the CAR file)
quote:
The HDATE function converts the date portion of a date-time value to the date format YYMD. You can then convert the result to other date formats.



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
February 20, 2008, 06:58 PM
Kymber
quote:
Francis



Env 1 Prod: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2
Env 1 Prod: WebFOCUS 5.3.2 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server
Env 2 Local: DevStudio 5.3.4 Servlet - Self Service - MS Windows XP SP2 - Apache Tomcat 5.0.28
Output: HTML, Excel 2000 and PDF
Posts: 2588 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005

Ignored post by Francis Mariani posted February 20, 2008 02:41 PM Show Post

Previous Topic | Next Topic powered by eve community
Please Wait. Your request is being processed...
[x]

SiteFocal Point
Servleteve2da016
Version1.2.22 build 9062
ModuleForums 4.0.3
Stylesheet"ibi"
Wordlet Set"Default Wordlet Set"
Logout: Focal Point
Update Groupee Account Reply




Thank You Francis! The HDATE did what I was looking for. I suppose I could have used HDIFF as well. Correct?
February 20, 2008, 06:59 PM
Kymber
Thank You Francis! The HDATE did what I wanted. I suppose I could have used the HDIFF as well. Correct?

Thanks again
February 21, 2008, 10:25 AM
Francis Mariani
quote:
HDIFF Returns the number of units of a specific date-time component between two date-time values.

You would have to use HDTTM to convert CURRDATE to HYYMD before using HDIFF.

Something like:

DT2/HYYMD = HDTTM(CURRDATE, 8, 'HYYMDIA');
DIFF_DAYS/D8 = HDIFF(DT2, FSTSTDT, 'DAY', 'D8');



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