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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Subtract 2 minutes from datetime

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Subtract 2 minutes from datetime
 Login/Join
 
Gold member
posted
-SET &TIME_STRT = HHMMSS('A8');
-SET &TIMEPART = EDIT('&TIME_STRT.EVAL','99$99$99');
-SET &TIMEPART = IF &TIMEPART.LENGTH LT 6 THEN '0' || &TIMEPART ELSE &TIMEPART ;
-SET &CURR_TS = '&YYMD.EVAL' | '&TIMEPART.EVAL' ;
-SET &CURR_TS_CONV = EDIT('&CURR_TS.EVAL','9999/99/99 99:99:99.000') ;
-TYPE Old: &CURR_TS_CONV

I looked at http://forums.informationbuild...431083832#8431083832
and tried

-SET &NEW_DTTM = HCNVRT(HADD(HINPUT(14, '&CURR_TS_CONV.EVAL' , 14, 'HYYMDS'), 'MINUTE', 5, 8, 'HYYMDS'), '(HYYMDS)', 20, 'A20');
-SET &NEW_DTTM1 = EDIT('&NEW_DTTM.EVAL', '9999/99/99 99:99:99.000');
-TYPE New: &NEW_DTTM

And I got the following incorrect result:

Old: 2011/11/21 10:13:54.000
New: 2011/11/21 10:13:05

I want
Old: 2011/11/21 10:13:54.000
New: 2011/11/21 10:11:54.000

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


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat
 
Posts: 79 | Registered: May 02, 2006Report This Post
Expert
posted Hide Post
-*-- Date/Time using Dialogue Manager --------------------------------------------

-SET &CUR_DATE = &YYMD;
-SET &CUR_TIME = EDIT(HHMMSS('A8'),'99$99$99');

-SET &CUR_DTTM = &CUR_DATE | &CUR_TIME;

-*-- Syntax --------------------------------------------------
-*-- HINPUT(inputlength, 'inputstring', length, outfield)
-*-- HADD(value, 'component', increment, length, outfield)
-*-- HCNVRT(value, '(fmt)', length, outfield)

-SET &NEW_DTTM1 = HCNVRT(HADD(HINPUT(14, '&CUR_DTTM.EVAL' , 14, 'HYYMDS'), 'MINUTE', -2, 8, 'HYYMDS'), '(HYYMDS)', 20, 'A20');

-SET &CUR_DTTM1 = EDIT(&CUR_DTTM, '9999/99/99 99:99:99');

-TYPE Old: &CUR_DTTM1
-TYPE New: &NEW_DTTM1


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
Gold member
posted Hide Post
Francis,
This the same as your original post except you made it -2.

I thought I tried that and it didnt work - but I was wrong - this is indeed what I need - thanks.


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat
 
Posts: 79 | Registered: May 02, 2006Report This Post
Platinum Member
posted Hide Post
Jammer/Francis, here is a slighlty more succinct method using HGETC to get the current date-time.

-SET &CURRENT_DTTM=HCNVRT(HGETC(20,'HYYMDS'),'(HYYMDS)',20,'A20');
-SET &NEW_DTTM=HCNVRT(HADD(HGETC(20,'HYYMDS'),'MINUTE',-2,8,'HYYMDS'),'(HYYMDS)',20,'A20');



In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
 
Posts: 161 | Location: Dallas, TX | Registered: February 20, 2009Report This Post
Gold member
posted Hide Post
DavSmith - thanks I will try it.


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat
 
Posts: 79 | Registered: May 02, 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] Subtract 2 minutes from datetime

Copyright © 1996-2020 Information Builders