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     [SOLVED] How to convert #of minutes in a day to a time of day

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to convert #of minutes in a day to a time of day
 Login/Join
 
Platinum Member
posted
We have an application that has converted the number of milliseconds into seconds and then into minutes in a day. So 600 minutes translates to 10am and 1020 minutes is 5pm (17th hour in a day. But when the number of minutes is 635 the result is 10.58 (Result/D5.2 635/60). How do I handle the remainder so that is will correctly handle the remainder?

Thanks in advance.
Rhonda

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS & ReportCaster 8.1.05, 7.7.03 - AIX/LINUX, FOCUS 7.6.13 MVS, Output PDF, XLS-XLSX, DOCX and HTML
 
Posts: 146 | Location: Atlanta, GA | Registered: May 31, 2007Report This Post
Expert
posted Hide Post
Check out the datetime function HADD


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
I had to do the same thing for schedule times displayed in minutes past midnight. This is how I accomplished this with a DEFINE:

-SET &NOWDATE = TODAY('A10');
-SET &SCH_MINS = 635;
DEFINE FILE CAR
-*SCH_DTE TO EQUAL DATE
SCH_DTE/MDYY=&NOWDATE;
-*PLACE HOLDERS FOR HOURS AND MINS
INP_HRS/I2=00;
INP_MIN/I2=00;
-*CREATE DATE WITH HOURS AND MINS (MM/DD/YYYY 00:00)
DATE_TIME/HMDYYS=HDTTM(SCH_DTE,8,'HMDYYI');
DATE_TIME/HMDYYI=HSETPT(DATE_TIME,'HOUR',INP_HRS,8,'HMDYYI');
DATE_TIME/HMDYYI=HSETPT(DATE_TIME,'MINUTE',INP_MIN,8,'HMDYY');
-*START TIME IS MINUTES FROM MIDNIGHT
SCH_ADD_MIN/I3=&SCH_MINS;
-*ADD MINUTES TO DATE_TIME PLACEHOLDER
SCH_START_TIME/HHI=HADD(DATE_TIME, 'MINUTE', SCH_ADD_MIN, 8, 'HHI');
END
TABLE FILE CAR
PRINT
COUNTRY NOPRINT
SCH_START_TIME
END


version 7.7.03, windows 7, microsoft office 2007
 
Posts: 13 | Location: Minnesota | Registered: October 03, 2012Report This Post
Platinum Member
posted Hide Post
Thanks for the recommendation from both WAZ and you. However, the problem with HADD is that I do not want to add time to the value. I want to convert the number of minutes to a time of day.
635 minutes I would think equal 10:35 AM..or am I way off base?

Rhonda


WebFOCUS & ReportCaster 8.1.05, 7.7.03 - AIX/LINUX, FOCUS 7.6.13 MVS, Output PDF, XLS-XLSX, DOCX and HTML
 
Posts: 146 | Location: Atlanta, GA | Registered: May 31, 2007Report This Post
Member
posted Hide Post
What do you want your output to be?
text or date/time format?

The above (the TABLE FILE CAR isn't the best table to use...but it works) produces 10:35 in a date/time format (you can change the /HHI to whatever format you want.

However, if you want Alphanumberic output you could do this:

-SET &MINS = 635;
DEFINE FILE CAR
TIME_HOUR/I2 = &MINS/60;
TIME_MIN/I2 = IMOD(&MINS, 60, 'I2');
TIME_SE /A3 = IF TIME_HOUR GE 12 THEN ' PM' ELSE ' AM';
TIME_OF_DAY/A8 = EDIT(TIME_HOUR) | ':' | EDIT(TIME_MIN) | TIME_SE;
END
TABLE FILE CAR
PRINT
COUNTRY NOPRINT
TIME_HOUR
TIME_MIN
TIME_SE
TIME_OF_DAY
END


version 7.7.03, windows 7, microsoft office 2007
 
Posts: 13 | Location: Minnesota | Registered: October 03, 2012Report This Post
Platinum Member
posted Hide Post
PERFECT!! Thank you all for your help and the solution that works for me. I have been so used to working with date-timestamp fields that sometimes the simple stuff eludes me.

Thanks again everyone!
Rhonda


WebFOCUS & ReportCaster 8.1.05, 7.7.03 - AIX/LINUX, FOCUS 7.6.13 MVS, Output PDF, XLS-XLSX, DOCX and HTML
 
Posts: 146 | Location: Atlanta, GA | Registered: May 31, 2007Report This Post
Expert
posted Hide Post
If you are interested, this is the Ts way:

-SET &MINS = 635;
DEFINE FILE CAR
TSDUMMY/HHI = DT(00000101000000000) ;
TIME_OF_DAY/HHIA = HADD(TSDUMMY,'minutes',&MINS,&MINS.LENGTH,TIME_OF_DAY); 
END
TABLE FILE CAR
PRINT
COUNTRY NOPRINT
TSDUMMY
TIME_OF_DAY
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 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     [SOLVED] How to convert #of minutes in a day to a time of day

Copyright © 1996-2020 Information Builders