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     [CLOSED] Time difference

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Time difference
 Login/Join
 
Silver Member
posted
Hi,
I have a difficulty finding the difference between the 2 timestamps.

The date, time and AM/PM information are getting passed from the launch page. I need to pull the data for date and time range mentioned in the launch page.
Ex - date1 = 2010/02/01
date2 = 2010/02/02
time1 = 10:00PM
time2 = 04:00AM
the report should run for these 2 days for the time range between 10:00PM to 04:00AM

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


769 Excel,PDF and HTML
 
Posts: 35 | Location: Bangalore | Registered: March 27, 2008Report This Post
Gold member
posted Hide Post
Hi,

If I understand correctly then you could convert each date to a datetime with something along the lines of:

DATE_R_TEMP1/DMYY = DATE_RAISED;
DATE_R_TEMP2/A8DMYY = DATE_R_TEMP1;
DATE_R_TEMP3/A10 = DATE_R_TEMP2;
DATE_R_TEMP_YR/A4 = EDIT(DATE_R_TEMP3, '$$$$9999');
DATE_R_TEMP_MT/A2 = EDIT(DATE_R_TEMP3, '$$99$$$$');
DATE_R_TEMP_DY/A2 = EDIT(DATE_R_TEMP3, '99$$$$$$');
DATE_R_TEMP4/A8 = DATE_R_TEMP_YR | DATE_R_TEMP_MT | DATE_R_TEMP_DY;
TM_R_TEMP1/A8 = TIME_RAISED;
TM_R_TEMP2/A6 = EDIT(TM_R_TEMP1, '99$99$99');
TM_R_TEMP3/A8 = EDIT(TM_R_TEMP2, '99:99:99');
DATE_TIME_R_TEMP/A20 = DATE_R_TEMP4 | ' ' | TM_R_TEMP3;
DATE_TIME_R1/HYYMDS = HINPUT(20, DATE_TIME_R_TEMP, 10, DATE_TIME_R1);

Do the same with the second datetime

Then calculate the difference:

DATEDIF (DATE_TIME_R1, DATE_TIME_R2, 'D');

There is probably a more efficient way to do this, but this does work for me!

Jinx.


7.6.11
Windows
HTML, PDF, Excel etc
DevStudio/Webfocus/Focus IBM
SQL Server 2000 / 2008
DB2
 
Posts: 78 | Location: UK | Registered: February 07, 2008Report This Post
Master
posted Hide Post
Have a look at this thread: http://forums.informationbuild...971057331/m/90910134 and see if that helps (especially the last post). You may have to concatenate your beginning date and time and your ending date and time to a single field, then do the comparison.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Virtuoso
posted Hide Post
What is/are the format of your database date/time column/s?


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
quote:
I have a difficulty finding the difference between the 2 timestamps


quote:
the report should run for these 2 days for the time range between 10:00PM to 04:00AM


Shru, I don't think I understand your need correctly. Do you need to retrieve data in a date/time range or do you need to calculate the difference between 2 timestamps?

If the former one applies, you might find the DT function very useful.

You can quickly retrieve records in a date/time range by using something like:

-SET &DATE1=20100201;
-SET &DATE2=20100202;
-SET &TIME1='10:00:00';
-SET &TIME2='16:00:00';
-*
TABLE FILE your_table
PRINT your_field
WHERE you_datestamp_field FROM DT(&DATE1 &TIME1) TO DT(&DATE2 &TIME2)
END


Read some documentation about the DT function to determine which format you need to use when passing parameters to it.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
There is a very good book available that gives you many many functions onluy onm dates
"(Almost) 1001 ways to work with dates in WebFocus"
ISBN: 978-0-9791711-1-2

I payed 25 USD...




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Silver Member
posted Hide Post
hi njsden,

i tried using DT function. But by using DT it will give me the complete range from start date to end date
ex : 2009/12/01 23:00:00- 2009/14/10 06:00:00
DT will give the records from 23:00:00 of 12 day to 06:00:00 of 14th day.
but what i am looking at is the records those are entered only through the time frame 23:00:00 - 06:00:00.

I just want to mention that the time is entered in 12 hour format in the launch page but in the database it is military format


769 Excel,PDF and HTML
 
Posts: 35 | Location: Bangalore | Registered: March 27, 2008Report This Post
Virtuoso
posted Hide Post
If I understand your requirement correctly, I think njsden's suggestion can still solve your challenge:

TABLE FILE your_table
PRINT your_field
WHERE your_datestamp_field FROM DT(&DATE1 &TIME1) TO DT(&DATE1 &TIME2)
   OR your_datestamp_field FROM DT(&DATE2 &TIME1) TO DT(&DATE2 &TIME2);
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
quote:
I just want to mention that the time is entered in 12 hour format in the launch page but in the database it is military format


Hi Shru, as far as I know DT() requires time in a 24-hour format. If your input is provided in a 12-hour format you'll have to convert it before passing it to DT() which is very easy to do; you may need to play a little with GETTOK to parse &TIME1 and obtain each time component.

Dan's example show you how to retrieve your records in a specific time frame. It has nothing to do with the use of the DT() function but in how you structure your selection criteria, which he clearly outlines there.

Regards,
- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report 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     [CLOSED] Time difference

Copyright © 1996-2020 Information Builders