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
Military Time
 Login/Join
 
Virtuoso
posted
Anyone know a routine to convert Military time to AM/PM. The only thing I've been able to find is a routine that takes the System Time and I can't seem to trick into taking my field instead of the System Time.
Here's the routine that does that.
CURRENT_TIME2/HHISA= HGETC(8,'HHISA');

I just have a field that is Time/A8 - 13:00:00 and I need it to print 01:00:00AM

Thanks

Prarie
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
First off on the 24 hour clock, 13:00 is 1:00 PM sorry couldn't resist.

I looked through functions and found nothing, but:

Check if you first field is gt 12 if it is then subtract 12 from it and put the PM on the end.

Of course first you'd have to convert the first two digits to a number using EDIT then tack it all back when complete.

HDIG/I2 = EDIT (TMFLD,'99');
HDIG/I2 = IF HDIG GT 12 THEN HDIG - 12 ELSE HDIG;
ADIG/A2 = EDIT(HDIG);
AMPM/A2 = IF HDIG GT 12 THEN 'PM' ELSE 'AM';
NEWTIME/A10 = ADIG | EDIT (MFLD,'$$999999') | APPM;

Of course the above hasn't been syntax checked. And what happens if it is 24:00:00, or is it 00:00:00 for midnight on the sytem? Also, for 12:00:00 which is noon do you code it as am or pm.

Such a tangled web when you start discussing how to do time.
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
Yes...it would be PM..;-)

I just had figured out this...which is basically what you were saying...after I figured there just was not going to be a neat function to do this for me. Now they have one that converts time to Midnight - HMIDNT...but not Military time go figure.

HRS1/I2 = EDIT(HRS);
HRS2/I2 = IF HRS1 GT 12 THEN HRS1 - 12 ELSE HRS1;
HRS3/A2 = EDIT(HRS2);
AM/A2 = IF HRS1 GT 12 THEN 'PM' ELSE 'AM';

NEWTIME/A7 = HRS3 | ':' | MIN | AM;
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
&TOD
is the system variable that prints in 24hour time. 13.40.55 is 1:40 and 55 secs .
Do you have timestamps as data fields in a file that you have to work with? or are you starting from scratch with system time?
I thought military time was gmt always, regardless of where you were in the world.
We have a way to extract your gmt offset from your reg.exe, if you're going that route.
(nb: win2k server)
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
No actually this is a time field that is stored I4 on a Help Call Center file, as a time a call was recorded. So it reads 0245...that is really saying 2:45...and 1300 is 13:00. So had to take and split into two. Rightside - Leftside.. concatenate it in to a Military time ...have no clue why it is like this...but that's what I have to work with...so I've converted it to a time and then did the little routine above...and seems to be working...
Hope that makes sense.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Master
posted Hide Post
Try This


NEWTIMEI4/I4 = IF TIMEFIELD GE 1300 THEN TIMEFIELD - 1200 ELSE TIMEFIELD;
NEWTIMEA4/A4 = EDIT(NEWTIMEI4);
NEWTIME/A8 = IF TIMEFIELD LT 1000 THEN EDIT(NEWTIMEA4, ' $9:99 AM') ELSE
IF TIMEFIELD LT 1200 THEN EDIT(NEWTIMEA4, '99:99 AM') ELSE
IF TIMEFIELD LT 1300 THEN EDIT(NEWTIMEA4, '99:99 PM') ELSE
IF TIMEFIELD LT 2000 THEN EDIT(NEWTIMEA4, ' $9:99 PM') ELSE
EDIT(NEWTIMEA4, '99:99 PM');
Don't know of any function but this should work replace TIMEFIELD with your actual field.

This message has been edited. Last edited by: <Mabel>,
 
Posts: 865 | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
I like that...Thanks...
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Member
posted Hide Post
susannah said:
quote:
I thought military time was gmt always, regardless of where you were in the world.
Actually military time is no longer done on gmt, its now based on zulu. I believe thats because gmt uses day light savings and the other does not.

The bigger question is does he mean military time, set to zulu or the 24 hour clock, which was created by miners.

Sorry I couldn't resist.
 
Posts: 11 | Location: Dearborn Mi | Registered: March 07, 2005Report This Post
<JG>
posted
Zulu and GMT are exactly the same thing the only difference is that GMT is the common mans name and Zulu is the Military name.

I quote from http://wwp.greenwichmeantime.com

'"Zulu" time is that which is more commonly know as "GMT"'
 
Report This Post
Silver Member
posted Hide Post
My timefield is format of Char 8 in the real database. I am trying to use this suggestion but it is not working. Any suggestions?
NEWTIMEI4/I4 = IF TIMEFIELD GE 1300 THEN TIMEFIELD - 1200 ELSE TIMEFIELD;
NEWTIMEA4/A4 = EDIT(NEWTIMEI4);
NEWTIME/A8 = IF TIMEFIELD LT 1000 THEN EDIT(NEWTIMEA4, ' $9:99 AM') ELSE
IF TIMEFIELD LT 1200 THEN EDIT(NEWTIMEA4, '99:99 AM') ELSE
IF TIMEFIELD LT 1300 THEN EDIT(NEWTIMEA4, '99:99 PM') ELSE
IF TIMEFIELD LT 2000 THEN EDIT(NEWTIMEA4, ' $9:99 PM') ELSE
EDIT(NEWTIMEA4, '99:99 PM');


V. 762
Windows XP
 
Posts: 47 | Registered: December 19, 2007Report This Post
Master
posted Hide Post
TIME1 is just to get a time in the 8 CHAR format in your database. If it is actually HH:MM:SS then the edit for TIME2A needs to be (TIME1,'99$99').

DEFINE FILE CAR
TIME1/A8='13240000';
TIME2A/A4=EDIT(TIME1,'9999');
TIME2/I4=EDIT(TIME2A);
TIME3/I4=IF TIME2 GE 1300 THEN TIME2-1200;
END

TABLE FILE CAR
PRINT TIME1 TIME2 TIME3
BY CAR
END


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
I like this too with one minor change.

quote:
IF TIMEFIELD LT 2000 THEN EDIT(NEWTIMEA4, ' $9:99 PM') ELSE

quote:
NEWTIMEI4/I4 = IF TIMEFIELD GE 1300 THEN TIMEFIELD - 1200 ELSE TIMEFIELD;
NEWTIMEA4/A4 = EDIT(NEWTIMEI4);
NEWTIME/A8 = IF TIMEFIELD LT 1000 THEN EDIT(NEWTIMEA4, ' $9:99 AM') ELSE
IF TIMEFIELD LT 1200 THEN EDIT(NEWTIMEA4, '99:99 AM') ELSE
IF TIMEFIELD LT 1300 THEN EDIT(NEWTIMEA4, '99:99 PM') ELSE
IF TIMEFIELD LT 2000 THEN EDIT(NEWTIMEA4, ' $9:99 PM') ELSE
EDIT(NEWTIMEA4, '99:99 PM');


IF TIMEFIELD LT 2000 THEN EDIT(NEWTIMEA4, ' $9:99 PM') ELSE

should be 2200 not 2000.


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Master
posted Hide Post
Come on Glenda, make him do a little bit of work!


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
Pat,

Normally I would agree with you. But this is Prairie and "she" has helped me many a time. Turn about fair play in this instance.


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Virtuoso
posted Hide Post
awwww Thanks...how nice. This was originally posted by me in 2005...and LOgle did their search...and was asking another quetion. But I did go back and look at my program...to make sure I had the correct number Glenda!!


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders