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.
I am searching for a way to add one hour from the date/time stamp to generate my output for a different timezone. Is there a way to do it with the date/time stamp or will I need to separate them?This message has been edited. Last edited by: Tamra,
"The HADD function increments a date-time value by a given number of units", including "year, quarter, month, day-of-year, day or day-of-month, week, weekday, hour, minute, second, millisecond, microsecond".
DT2/HYYMDS=HGETC(10, 'HYYMDS'); Get current date and time DT3/HYYMDS=HADD(DT2, 'HOUR', 1, 8, 'HYYMDS'); add one hour for Central Time DT4/MDYY=HDATE(DT3,'MDYY'); Extract date TMHR1/I2L=HPART(DT3, 'HOUR', 'I2'); Extract hour TMMIN1/I2L=HPART(DT3, 'MINUTE', 'I2'); extract minute TMSEC1/I2L=HPART(DT3, 'SECOND', 'I2'); extract seconds TMTIME/A8=EDIT(TMHR1) | ':' | EDIT(TMMIN1) | ':' | EDIT(TMSEC1) ; concatenate time
I pulled current date/time first then extracted components so that the date would be correct between 12:00 pm and 1:00 am.
Originally posted by Francis Mariani: Have you looked into the HADD function?
"The HADD function increments a date-time value by a given number of units", including "year, quarter, month, day-of-year, day or day-of-month, week, weekday, hour, minute, second, millisecond, microsecond".
Can this be used with Dialoge Manager too? I'm trying to subtract 24 hours from the current system date/time and not having much luck. Any ideas? Carol
------------------------------------------ last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
Posts: 36 | Location: Rolling Meadows, IL | Registered: September 05, 2007
I haven't used it directly with Dialogue Manager so I can't answer that, but, sometimes, when you can't do something with Dialogue Manager, you do it with TABLE.
Here's an example where I add five minutes to a DM variable that contains the current Date/Time:
-SET &ECHO=ALL;
SET HOLDLIST = PRINTONLY
SET HOLDFORMAT = ALPHA
-RUN
-SET &CURR_DATE = &YYMD;
-SET &CURR_TIME = EDIT(HHMMSS('A8'),'99$99$99');
-SET &CURR_DTTM = &CURR_DATE | &CURR_TIME;
TABLE FILE CAR
PRINT CAR NOPRINT
COMPUTE CURR_DATE/HYYMDS = HINPUT(14, '&CURR_DTTM', 8, 'HYYMDS'); NOPRINT
COMPUTE NEW_DATE/HYYMDS = HADD(CURR_DATE, 'MINUTE', 5, 8, 'HYYMDS');
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD
END
-RUN
-READ HOLD &NEW_DATE.A8. &NEW_TIME.A6.
-TYPE &NEW_DATE - &NEW_TIME
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
HINPUT converts a alpha Dialogue Manager variable to a Date/Time value. HADD increments the Date/Time value by the specified component and amount. HCNVRT converts the incremented Date/Time value back to an alpha Dialogue Manager variable. One caveat: the value returned contains / and : separators which can easily be removed using EDIT. I could have nested the EDIT with the other functions, but that would have been overkill.
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
You both are awesome!!! Thanks so much!!! I'll give it a try. I do need to subtract hours though...it all depends but thanks for reminding me about AYMD too.
------------------------------------------ last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
Posts: 36 | Location: Rolling Meadows, IL | Registered: September 05, 2007
In case anyone needs it, here is Francis' wonderful code, but using the system time that contains milliseconds(HH:MM:SS:msmsms)
-*here are the individual steps needed to add 12hrs to the time and then present final with date: -*1).get system time with milliseconds; -*2).add 12 hours; -*3).convert to look presentable in alpha; -*get the time in HH:MM:SS:msmsms i.e. (&NOWDTTM = 2007/09/26 10:38:44.614797) -SET &NOWTIME=HGETC(10,'HHISSM'); -*add 12hrs to time only -SET &NOWTM12=HADD(&NOWTIME,'HOUR',12,10,'HHISsm'); -*convert so that it doesn't look like garbage -SET &NOWTM=HCNVRT(&NOWTM12, '(HHISsm)', 15, A15); -*here is one step to get it all done at once -SET &NOWTIME=HCNVRT(HADD(HGETC(10,'HHISSM'),'HOUR',12,10,'HHISsm'),'(HHISsm)',15,A15); -*then merge with date: -* get date: -SET &NOWDATE = EDIT(&YYMD,'9999/99/99'); -* concatenate date with newtime -SET &NOWDTTM = &NOWDATE |' '| &NOWTIME; -*dump all ampervars -? & -RUN -*to use in a WHERE condition, string &NOWDTTM as one value using DT(&xx): TABLE FILE xxxx SUM yyyy WHERE xDATE LE DT(&NOWDTTM); END -RUN
------------------------------------------ last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
Posts: 36 | Location: Rolling Meadows, IL | Registered: September 05, 2007
Thank you, thank you...no applause though...just throw money... ...seriously though...my poor little brain is going to ooze from my ears and eyes soon . I cannot believe how much I have forgotten, yet also learned and re-learned from this forum, not to mention, the newer stuff that I didn't even know existed. I do truly appreciate all who help.
------------------------------------------ last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
Posts: 36 | Location: Rolling Meadows, IL | Registered: September 05, 2007
I think this is pretty slick so I tried it. It did not work. At least in our environment, the 2nd parm in the HGETC function needs to be 'HHISsm' not 'HHISSM'. Once I made that change, it worked like a champ.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006