Focal Point
Extracting TIme

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

August 23, 2007, 11:21 AM
MadamZuZu
Extracting TIme
hi Smiler

how do i extract JUST time from the following:

TABLE FILE EMPLOYEE
PRINT LAST_NAME FIRST_NAME
COMPUTE RAISETIME/HMDYYIA = DT(20000101 9:00AM);
COMPUTE MYTEST/HDIA = RAISETIME;
----- THE LAST COMPUTE LOOKS LIKE THIS:
01 9:00AM

HOW DO I GET RID OF THAT 01 UP FRONT? Frowner
END

i need to compare the time (including the am/pm only)

Thanks!

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


~~~||~~~||~~~||~~~||~~~||~~~||~~~||~~~||~~~||~~~
PROD: WebFOCUS 7.1.3 on Win 2K/IIS 6/ISAPI Mode/Self-Serve Apps Only (No App Server)
TEST: WebFOCUS 7.1.3 on Win 2K/IIS 6/Weblogic 8.1/Servlet Mode
August 23, 2007, 11:34 AM
Francis Mariani
Always ready to help MadamZuZu (what does the second Zu stand for?)

Isolating the time for a Date/Time column:

-*-- SETUP DATE/TIME FOR SQL ---
-SET &RUN_DT    = EDIT(&YYMD,'9999/99/99');
-SET &RUN_TM    = EDIT(HHMMSS('A8'),'99$:99$:99');
-SET &RUN_DTTMS = &RUN_DT | ' ' | &RUN_TM;


DEFINE FILE CAR
FAKEDATE/HYYMDS = HINPUT(14,'&RUN_DTTMS', 8, 'HYYMDS');
BOL_CREATED/HMDYYIA=FAKEDATE;
BOL_TIME/HHIA = BOL_CREATED;
END
-RUN 

TABLE FILE CAR
PRINT
BOL_CREATED BOL_TIME
BY CAR
END


Not sure about comparing two time fields though...


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
August 23, 2007, 11:41 AM
dhagen
You can use the HTIME() function to extract the time in milliseconds.
COMPUTE C_TIME/D12 = HTIME(8,BOL_CREATED,'D12'); 



"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
August 23, 2007, 11:42 AM
Francis Mariani
Ah yes, then you CAN compare. Thanks dhagen.


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
August 23, 2007, 01:10 PM
MadamZuZu
what if i need to do a "WHERE" on my time

TABLE FILE EMPLOYEE
PRINT LAST_NAME FIRST_NAME
COMPUTE RAISETIME/HMDYYIA = DT(20000101 9:00AM);
COMPUTE MYTEST/HHIA = RAISETIME;
END

i can't compare a date-time field to an alpha...
so, for example. how can i get all the records which are ater 12:00am?


~~~||~~~||~~~||~~~||~~~||~~~||~~~||~~~||~~~||~~~
PROD: WebFOCUS 7.1.3 on Win 2K/IIS 6/ISAPI Mode/Self-Serve Apps Only (No App Server)
TEST: WebFOCUS 7.1.3 on Win 2K/IIS 6/Weblogic 8.1/Servlet Mode
August 23, 2007, 01:22 PM
Francis Mariani
You may need to use dhagen's suggestion and create a field with the extracted time in milliseconds and use that field in the WHERE statement - 12:00am is midnight so it's 0 milliseconds (I think)

WHERE C_TIME GT 0



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