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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     HOW TO DISPLAY SECONDS TO HH:MM:SS

Read-Only Read-Only Topic
Go
Search
Notify
Tools
HOW TO DISPLAY SECONDS TO HH:MM:SS
 Login/Join
 
Platinum Member
posted
I have a field that shows time in seconds. Is there a way to convert this field to hh:mm:ss plus also add a negative sign where needed. Ex -00:02:00 = 2 minutes late on a shift.

Thanks for any help

Joe


WebFocus 7.7.02 WinXP
 
Posts: 236 | Registered: May 12, 2006Report This Post
Virtuoso
posted Hide Post
there are probably better ways...but I've used this in the past.

DEFINE FILE CAR
NUMSEC/I4 = 244;
HOUR/I2 = (NUMSEC/60) ;
MIN/I2 = ((NUMSEC/60 - (HOUR *60)));
HHMMSS/I6= INT( NUMSEC/3600 ) * 10000
+ INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100 +
IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99:99');
END
TABLE FILE CAR
PRINT CAR
TIME
END


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Platinum Member
posted Hide Post
Thanks,
I tried your ex. but still did not get correct results. For ex., one of the records has -60.00 seconds for the time value. I got 00:00:00 instead of getting -00:01:00.

Here's my code:

DEFINE FILE TBLARCH
NUMSEC/I4 = START;
HOUR/I2 = (NUMSEC/3600);
MIN/I2 = ((NUMSEC/24 - (HOUR *60)));
HHMMSS/I6= INT( NUMSEC/3600 ) * 10000 + INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100 + IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99:99');

END

TABLE FILE TBLARCH
SUM
START
TIME
STOP
SCHEDULED
SIGNED_IN
COMPLIANCE

BY EMP_SHORT_NAME

Thanks for any assistance possible.


WebFocus 7.7.02 WinXP
 
Posts: 236 | Registered: May 12, 2006Report This Post
Expert
posted Hide Post
Joe,

Prarie's example works fine; you didn't mention that the values were negatives, so, just add:

NUMSEC/I4 = IF START LT 0 THEN START * (-1) ELSE START;

Also, if you always want to display as a negative:

TIME/A9= '-' | EDIT(HHMMSS,'99:99:99');


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
This works for positive numbers, I'm still trying to work out negative numbers.

DEFINE FILE CAR
NBR_SECONDS/D8 =
IF COUNTRY EQ 'ENGLAND'       THEN -60 ELSE
IF COUNTRY EQ 'FRANCE'        THEN 456666 ELSE
IF COUNTRY EQ 'ITALY'         THEN 127 ELSE
IF COUNTRY EQ 'W GERMANY'     THEN 180 ELSE
IF COUNTRY EQ 'JAPAN'         THEN -1 ELSE 481;

CURR_DATE/HHIS = HINPUT(14, '&YYMD.000000', 8, 'HYYMDS');
POS_DATE/HHIS = IF NBR_SECONDS GE 0 THEN HADD(CURR_DATE, 'SECOND', NBR_SECONDS, 8, 'HYYMDS') ELSE CURR_DATE;
END
-RUN

TABLE FILE CAR
PRINT
NBR_SECONDS
POS_DATE
BY COUNTRY
END
-RUN

Joe, what version are you on? Perhaps you could update you signature, as per this request: Friendly reminder: Please update your signatures
[/code]


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Just for clarification, the only way to display what you want is in string format. There is no concept of negative time (only in the Twilight Zone) so any timestamp format would not work - it can't display -60 seconds. A combination of Prarie's code and Tom's addition for the negative will be what you're looking for. You'll first have to make seconds positive then add the negative after making calculations.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Platinum Member
posted Hide Post
quote:
WebFOCUS 7.6.1 Win 2003

Thanks,

I'm going to try Tom's suggestion. I think I can make that work.

Joe


WebFocus 7.7.02 WinXP
 
Posts: 236 | Registered: May 12, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     HOW TO DISPLAY SECONDS TO HH:MM:SS

Copyright © 1996-2020 Information Builders