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:00AMThis message has been edited. Last edited by: Kerry,
769 Excel,PDF and HTML
February 22, 2010, 09:10 AM
Jinx
Hi,
If I understand correctly then you could convert each date to a datetime with something along the lines of:
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
February 22, 2010, 09:12 AM
ABT
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.
What is/are the format of your database date/time column/s?
WebFOCUS 7.7.05
February 22, 2010, 12:31 PM
njsden
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.
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
February 23, 2010, 06:44 AM
Shru
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
February 23, 2010, 07:05 AM
Dan Satchell
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
February 23, 2010, 09:59 AM
njsden
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.