Date / Time Range Selection

Post Author: LDFCC
CA Forum: Formula
I am trying to create a report using Crystal Report XI which prompts the user to enter a start date / end date / start time & end time. For example, the person will select 9/19 (start date), 9/20 (end date), 10 AM (Start time), 10:30 AM (End Time). The report correctly pull up all tickets from 9/19 till 9/20 but only displays the tickets from 9/19 from 10 - 10:30 AM and 9/20 from 10 - 10:30 AM. I need it to show all tickets from 9/19 10:00 AM till 9/20 10:30 AM. Both the time and date are two seperate fields in the database. Any help is greatly appreciated.
Thanks.

Post Author: LDFCC
CA Forum: Formula
yangster:
since you are dealing with 2 seperate fields for date and time the first thing you want to do is merge them back into one so things are consistenttry putting this in your selection expert
datetimevar begin_date_time := datetime(cdate(?begin date), ctime(?begin time));datetimevar end_date_time := datetime(cdate(?end date), ctime(?end time));datetime(cdate(date_field), ctime(time_field)) in begin_date_time to end_date_time
I tried this and I get an error because it says that (?begin date), (?begin time), (?end time), and (?end date) all have to be date time fields but they are not the date field is only date field and same with the time fields. Any suggestions?

Similar Messages

  • Collapsing rows - date/time ranges

    Hi,
    I need to collapse date/time ranges (1 range per row) into the smallest continuous block for a particular item, instance (date/time).
    For example,
    CREATE TABLE "BLOCK_TEST"
       "ID" NUMBER,
       "START_BLK" DATE,
       "STOP_BLK" DATE
    alter session set nls_date_format = "YYYY-MM-DD HH24:MI";
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (1, TO_DATE('2006-07-03 01:00'), TO_DATE('2006-07-03 01:30'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (1, TO_DATE('2006-07-03 01:30'), TO_DATE('2006-07-03 02:00'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (1, TO_DATE('2006-07-03 02:00'), TO_DATE('2006-07-03 02:30'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (1, TO_DATE('2006-07-03 02:30'), TO_DATE('2006-07-03 03:00'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (1, TO_DATE('2006-07-03 03:30'), TO_DATE('2006-07-03 04:00'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (1, TO_DATE('2006-07-03 04:00'), TO_DATE('2006-07-03 04:30'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (2, TO_DATE('2006-07-03 02:00'), TO_DATE('2006-07-03 02:30'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (2, TO_DATE('2006-07-03 02:30'), TO_DATE('2006-07-03 03:00'));
    INSERT INTO BLOCK_TEST ("ID","START_BLK","STOP_BLK") VALUES (2, TO_DATE('2006-07-03 03:00'), TO_DATE('2006-07-03 03:30'));
    select * from block_test order by id, start_blk;
    ID      START_BLK               STOP_BLK
    1     2006-07-03 01:00     2006-07-03 01:30
    1     2006-07-03 01:30     2006-07-03 02:00
    1     2006-07-03 02:00     2006-07-03 02:30
    1     2006-07-03 02:30     2006-07-03 03:00
    1     2006-07-03 03:30     2006-07-03 04:00
    1     2006-07-03 04:00     2006-07-03 04:30
    2     2006-07-03 02:00     2006-07-03 02:30
    2     2006-07-03 02:30     2006-07-03 03:00
    2     2006-07-03 03:00     2006-07-03 03:30If ID = 1 and my instance is 2006-07-03 01:45, I need to obtain 2006-07-03 01:00 as the start of the block and 2006-07-03 03:00 as the end - notice the gap from 3:00 to 3:30 so the end would not be 4:30.
    I can do this in a procedure but I was wondering if this could be done with just SQL?
    Any hints, suggestions or opinions would be welcome.
    Thanks,
    dfg
    EDIT: After re-reading this, need to clarify that I don't need to actually change or update the rows, just query to get the start and end of the block in question...
    Message was edited by:
    Indy

    There might be better ways but the following worked for me
    SQL> select
      2        first_value(start_blk) over (partition by id ORDER BY lvl desc),
      3        first_value(stop_blk) over (partition by id ORDER BY lvl desc)
      4  from (select level lvl, id, connect_by_root start_blk start_blk, stop_blk
      5        from (select id , start_blk, stop_blk
      6              from   block_test
      7              where  id=1
      8             )
      9        connect by prior stop_blk=start_blk
    10        order by level desc
    11       )
    12  where to_date('2006-07-03 01:45', 'YYYY-MM-DD HH24:MI') between start_blk and stop_blk
    13  and rownum < 2
    14  ;
    FIRST_VALUE(STAR FIRST_VALUE(STOP
    2006-07-03 01:00 2006-07-03 03:00
    SQL> select
      2        first_value(start_blk) over (partition by id ORDER BY lvl desc),
      3        first_value(stop_blk) over (partition by id ORDER BY lvl desc)
      4  from (select level lvl, id, connect_by_root start_blk start_blk, stop_blk
      5        from (select id , start_blk, stop_blk
      6              from   block_test
      7              where  id=1
      8             )
      9        connect by prior stop_blk=start_blk
    10        order by level desc
    11       )
    12  where to_date('2006-07-03 03:15', 'YYYY-MM-DD HH24:MI') between start_blk and stop_blk
    13  and rownum < 2
    14  ;
    no rows selected
    SQL> select
      2        first_value(start_blk) over (partition by id ORDER BY lvl desc),
      3        first_value(stop_blk) over (partition by id ORDER BY lvl desc)
      4  from (select level lvl, id, connect_by_root start_blk start_blk, stop_blk
      5        from (select id , start_blk, stop_blk
      6              from   block_test
      7              where  id=1
      8             )
      9        connect by prior stop_blk=start_blk
    10        order by level desc
    11       )
    12  where to_date('2006-07-03 03:45', 'YYYY-MM-DD HH24:MI') between start_blk and stop_blk
    13  and rownum < 2
    14  ;
    FIRST_VALUE(STAR FIRST_VALUE(STOP
    2006-07-03 03:30 2006-07-03 04:30
    SQL>

  • Can i print date/time on selected photos in IPhoto? (version 9.5.1)

    Can I print date/time on selected photos in IPhoto?

    Yes, with the iBorderFx plugin, which is free.
    http://www.iborderfx.com/iborderfx/

  • How to return a specific date/time range and last event details, when checking the event log via command prompt

    I am new to scripting (literally started reading/learning scripting a few hours ago), and I am stuck in trying to get my current script/command to filter a specific date range.
    * Note: I am working with Server 2003 and 2008; because of the environment I am in, a lot of scripts (such as Powershell and VBScript) don't work; trying to stick with command line, as it appears to be the only thing that functions correctly in my environment
    I am trying to search the System log in event viewer, for the most recent server reboot. Here is the command that I am currently running:
    ===========================================================
    C:\Windows\System32\cscript C:\Windows\System32\eventquery.vbs /L System /FI "id eq 1074"
    ===========================================================
    When run, the output looks like this:
    ===========================================================
    Microsoft (R) Windows Script Host Version 5.6
    Copyright (C) Microsoft Corporation 1996-2001. All rights reserved
    Listing the events in 'system' log of host 'xxxxxxxxxxxxxxx'
    Type Event
    Date Time    Source
    Information 1074
    12/18/2013 2:48:06 AM    USER32
    Information 1074
    11/20/2013 3:25:04 AM    USER32
    Information 1074
    10/23/2013 2:06:09 AM    USER32
    ===========================================================
    What I would like it to do is only show events that have happened in the last seven days, as well as show the event details if it does find an event that matches the criteria.
    Any help would be greatly appreciated. Thanks!
    Nick

    I would prefer using Powershell , you can use below code 
    function Get-EventViewer
    param(
    [string[]]$ComputerName = $ENV:COMPUTERNAME,[string]$LogName,[int]$eventid
    $Object =@()
    foreach ($Computer in $ComputerName)
    $ApplicationEvents = get-eventlog -logname $LogName -cn $computer -after (Get-Date).AddDays(-7) | ?{$_.eventid -eq "$eventid" }
    foreach ($event in $ApplicationEvents) {
    $Object += New-Object -Type PSObject -Property @{
    ComputerName = $Computer.ToUpper();
    TimeGenerated = $event.TimeGenerated;
    EntryType = $event.EntryType;
    Source = $event.Source;
    Message = $event.Message;
    $column1 = @{expression="ComputerName"; width=12; label="ComputerName"; alignment="left"}
    $column2 = @{expression="TimeGenerated"; width=22; label="TimeGenerated"; alignment="left"}
    $column3 = @{expression="EntryType"; width=10; label="EntryType"; alignment="left"}
    $column4 = @{expression="Source"; width=15; label="Source"; alignment="left"}
    $column5 = @{expression="Message"; width=100; label="Message"; alignment="left"}
    $Object|format-table $column1, $column2, $column3 ,$column4 ,$column5
    $Object.GetEnumerator() | Out-GridView -Title "Event Viewer"
    You can do a function call like
    Get-EventViewer -LogName system -ComputerName "computername" -eventid "2017"

  • How to select data, based on a specified or preset date/time range

    Hi,
    I am trying to construct a requirement like this in java/jsp.
    I have a table consisting of registered users info. Have a expiration date for every user, which was captured or set when they originally registered.
    I have to select all those users who are expiring two weeks from now.
    For example. if the current date is 14th, I should get a list of users who expire between the midnight of 24th sunday to 30th saturday. this covers the whole last 7days in that range. And so on.
    So based on the current date, the last midnight sunday to midnight saturday of that two week's range should be selected.
    The input fields for this range on the userend should default to this range.
    And also the user should be able to specify their own range and be able to pull data.
    the result should be populated as viewable as well as a downloadable tab de-limited file for mass mailing.
    (ex. the table might be queried for user info like id, email, expiration date, fullname, and shown accordingly in the jsp)
    I know this is a longshot.. but if somebody can guide me will be good as I am new to this forum and as well as java.

    Well, I can start you off with this:
    Calendar now = Calendar.getInstance();
    // shift 2 weeks and back to Sunday
    Calendar start = Calendar.getInstance();
    start.add(Calendar.DATE, 14);
    end.set(Calendar.HOUR, 0);
    end.set(Calendar.MINUTE, 0);
    end.set(Calendar.SECOND, 0);
    end.set(Calendar.MILLISECOND, 0);
    while(start.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
    start.add(Calendar.DATE, -1);
    // shift 2 weeks and up to Saturday (following Sundat midnight, actually)
    Calendar end = Calendar.getInstance();
    end.add(Calendar.DATE, 14);
    end.set(Calendar.HOUR, 0);
    end.set(Calendar.MINUTE, 0);
    end.set(Calendar.SECOND, 0);
    end.set(Calendar.MILLISECOND, 0);
    while(end.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
    end.add(Calendar.DATE, -1);
    At this point, start is the first Sunday before the day 2 weeks from today and end is the first Sunday after the day 2 weeks from today, both at midnight. You could make end stop at Saturday and make the time 23:59:59:999, of course.
    If you ran it today, it should be 11/9 and 11/16.

  • Query Based on Date & Time Range

    Hello Users,
    There is a requirement to display weekly report from saturday 8:00 AM to previous saturday 08:00 AM.
    I have a table "Downtime"
    IPADDRESS       First Occurrence                   Last Occurrence           Downtime
    172.29.10.12    31-JUL-10 08:12:50             01-AUG-10 09:00:00      1
    172.29.11.54    01-AUG-10 11:12:00            01-AUG-10 01:10:00      3
    172.29.58.7      07-AUG-10 04:10:00            07-AUG-10 05:00:00      2I will not have problem when I run the report on saturday as I can give condition as sysdate - 7.
    First problem is how will I default to 8 AM.
    Second if the report is run on sunday or in between before next saturdya I have to query the records only from satuday 8 AM to previous saturday 8 AM.
    Can anyone please help me on this?
    Thanks.
    Ravi.

    Hi,
    hoek wrote:
    That's a great hint, Solomon, thanks.
    I always end up getting frustrated because trunc on a date returns a NULL for 'midnight'....and the ability to perform date arithmetic is gone all of a sudden. Why isn't Oracle just resetting to '00:00:00' when truncating a date, I wonder?I must not understand what you're asking.
    It sounds as if you're saying that TRUNC (dt) sometimes returns something that is NULL (or somehow partially NULL), but I'm sure you don't really think that.
    For other readers who may be wondering:
    TRUNC (dt), where dt is a DATE (and not NULL) , always returns a DATE, and DATEs always have a time. Either the whole DATE is NULL or none of it is; you can't have a year-month-day in a DATE column and not have a time, or have a NULL time.
    TRUNC(dt, x) may return a DATE where the time is not midnight, but only if x is a format string like 'MI' that specifies an interval less than a day. When x indicates a longer interval (e,g, 'IW'), or when x is omitted, the time is always midnight. In any event, you can do date arithmetic on the results.
    I'm sure you understand this, but your question makes it sound like you don't.
    This should illustrate my point:
    -- generating hours, starting 14 days ago:
    with t as (
    select trunc(sysdate-14)+ level/24-1 dt
    from   dual
    connect by level <= 24*14
    -- querying generated data:
    select dt
    --,      trunc(dt,'iw') - 5/3  -- great workaround, but why can't we just work with 00:00:00 for the time component?
    from   t;
    -- generating hours, starting 14 days ago:
    with t as (
    select trunc(sysdate-14)+ level/24-1 dt
    from   dual
    connect by level <= 24*14
    -- querying data between saturday and previous saturday
    -- from the same resultset and 'it doesn't work'
    select dt
    from   t
    where  dt between trunc(dt-7)+8/24 and trunc(sysdate)+8/24;
    Is this a parody of a poorly written question?
    Are you trying to make the point that no one should ever say "it doesn't work" without explaining exactly what doesn't work, and what the expected output is?
    I get the same 336 rows when I run either of the queries above.
    As you've often said, posters should always show exactly what results they want.

  • Will 'Event' in the timeline support "Date/Time Range" and "Location"?

    Currently the 'Event' seems to be limited in a simple one day event as well as not able to specfiy a location(using description is a workaround). I am wondering if it will be supported in the futrure. I am it's a good to have since Streamwork is on the mobile device(iphone) already.

    Hi,
    Enhancements to the timeline are planned: you can check for yourself at http://feedback.streamwork.com/forums/11095-sap-streamwork/suggestions/409174-timeline-should-support-multi-day-events?ref=title. If you have additional enhancment request just go ahead and submit them via the "Feedback" button on the right of StreamWork. You can also vote for already entered enhancemetn request.
    Regards, Rüdiger

  • Datalogging with options to retrieve subset of log file based on date/time

    I would like to thank this forum for useful advice so far in completing my LabVIEW software.
    I have a data logging challenge. I am supposed to log about 30 parameters every 5 seconds. Some of these parameters are digital (ON/OFF), some are values of speed (rpm) and others, an expression of a percentage (%). It should be possible in future to do a histogram or bar chart plot of some of the parameters, for a specific period range (say the last 5 minutes of a certain day). So in effect, do an extraction of a segment of the total log file.
    My challenge is if I use text file, like the one in the attached VI, can it give functionality of retrieving data (while the VI is running) from the log file, based on a certain time range (i.e. retrieve a section of the log file based on a certain date/time range, on demand)?
    The format in the text file is close to what I require, since it lists the time n one column and the other parameters on other columns to enable future histogram generation.
    Thanks a lot, friends.
    Solved!
    Go to Solution.
    Attachments:
    writer.vi ‏19 KB
    time.txt ‏1 KB

    Hey maxidivine,
    Iv been playing round with your code and found that to perform the search that you require could be quite demanding to system resources when scaled to the size of your application I shall try and find a way to perform the search using .txt files but the there are some other options available. I recommend the use if TDMS files as the file format is a very efficient, manageable method of data-logging. The TDMS file format is designed to write and read measured data at a very high speed, while maintaining a hierarchical system of descriptive information.
    Traditionally, TDMS was a National Instruments only file format – you could only read it using our products – LabVIEW/CVI/DIAdem. However, thanks to the popularity of the format, a bolt-on is now available for Excel, which allows you to directly open the .tdms files with Excel (see link).
    National Instruments Technical Data Management Overview
    http://zone.ni.com/devzone/cda/tut/p/id/3676
    Introduction to LabVIEW TDM Streaming Vis
    http://zone.ni.com/devzone/cda/tut/p/id/3539
    VI-Based API for Writing TDMS Files
    http://zone.ni.com/devzone/cda/tut/p/id/6471
    TDM Excel Add-In Tool for Microsoft Excel User Guide
    http://zone.ni.com/devzone/cda/tut/p/id/4906
    TDM Excel Add-In for Microsoft Excel Download
    http://zone.ni.com/devzone/cda/epd/p/id/2944
    Troubleshooting the TDM Excel Add-In for Microsoft Excel 2000-2003
    http://zone.ni.com/devzone/cda/tut/p/id/5874
    Examples of the use of the TDMS API ship with LabVIEW. You will find them in HELP > find examples > fundamentals > File Input and Output. For you application, I would recommend the “Cont Acq&Graph Voltage - Write Data to File (TDMS).vi”.
    Furthermore, if you require some help with DIAdem, I would recommend clicking "getting started" from the DIAdem splash screen. This opens a manual which discusses everything from data analysis to report generation. Also, if you have DIAdem 11 or above, there are tutorial videos which install with DIAdem. These are useful little tutorials, which discuss all the DIAdem fundamentals. You can access these by selecting a particular palette tab (eg. report, view, analysis...etc) and then clicking the tutorial button (shown as a film strip with a question mark) at the top of the group view.
    Here are some more helpful DIAdem related resources for future reference.
    Report Gen in DIAdem...
    http://zone.ni.com/devzone/cda/tut/p/id/7379
    DataPlugins: Supported Data Formats (ni.com/dataplugins)
    http://zone.ni.com/devzone/cda/tut/p/id/4065
    Hope this is helpful
    Philip
    Philip
    Applications Engineer
    National Instruments
    UK Branch
    ===If this fixes your problem, mark as solution!===

  • Date/Time Calculation ?

    I have a query that hopfully someone can resolve.
    The below select statment returns the below column and as you can see, two of these columns hold date/time information
    select IR.doc_no, AR.line_no, AR.step_no, AR.description, AR.app_sign, AR.approval_status, ir.dt_doc_rev, AR.app_date
    from APPROVAL_ROUTING AR,
    ISSUE_REFERENCE IR
    where
    AR.key_ref = IR.key_ref
    and ar.key_ref like '%1050387%'
    order by ar_step_no
    ** Output **
    Doc_No     Line_No     Step_No     Description     App_Sign     Approval_Status     Dt_Doc_Rev          App_Date
    1050387     4     10     P          B          Approved     2010-04-16-15.52.31     2010-04-16-17.00.01
    1050387     1     20     C          P          Approved     2010-04-16-15.52.31     2010-04-19-13.22.18
    1050387     2     30     Q          A          Approved     2010-04-16-15.52.31     2010-04-19-13.57.29
    1050387     5     40     P          H          Approved     2010-04-16-15.52.31     2010-04-20-13.14.34
    1050387     6     50     S          B          Approved     2010-04-16-15.52.31     2010-04-20-14.47.22
    1050387     7     50     P          H          Approved     2010-04-16-15.52.31     2010-04-20-13.49.30
    1050387     3     60     S          H          Approved     2010-04-16-15.52.31     2010-04-21-12.15.06
    1050387     8     70     A          (          Approved     2010-04-16-15.52.31     2010-05-06-10.14.52
    What I want to do is calculate (and output in a separate column) in days/hours how long each step took (Step_No). So as an example, step 10 > step 20 took '1 hour 7 mins 30 sec'. Any assistance would be greatly appreciated.

    Hi,
    If your column is not a timestamp, you can cast it to timestamp and use ths available features by Oracle.
    with data as(
    select 1050387 doc_no,
           4 line_no,
           10 step_no,
           'P' descripti,
           'B' app_sign,
           'Approved' approval_status,
           cast(to_date('2010-04-16-15.52.31', 'YYYY-MM-DD-HH24.MI.SS') as
                timestamp) Dt_Doc_Rev,
           cast(to_date(' 2010-04-16-17.00.01', 'YYYY-MM-DD-HH24.MI.SS') as
                timestamp) app_date
      from dual
    select doc_no,
           line_no,
           step_no,
           descripti,
           app_sign,
           approval_status,
           extract(day from(app_date - Dt_Doc_Rev)) Days,
           extract(hour from(app_date - Dt_Doc_Rev)) hours,
           extract(minute from(app_date - Dt_Doc_Rev)) minutes,
           extract(second from(app_date - Dt_Doc_Rev)) seconds
      from databtw i am on
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as scottRegards,
    Bhushan

  • Display "Last Updated" date & time in footer?

    I share Numbers '09 worksheets over a network with my colleague.
    Is there a way to display the date & time of the most recent update (i.e. saved update) in the footer of a worksheet?
    I realize this info is available via the Inspector, but it would be very handy to have it printed out along with the data to ensure we are working off the same document revision.

    Insert > Date & Time into your Header, Footer, Shape, etc.
    Right-Click the Date & Time and select Edit Date & Time. In the dialog window that opens, check the box for Automatically Update on Open.
    Regards,
    Jerry

  • Set Date & Time Using Time Zone

    Hello everyone,
    Thanks in advance for any ideas you may have.
    I would like to be able to change the time using the time zones - i.e. when I open date & time and select the time zone I’m in, I want the time to change to reflect where I am. Currently, when I change the time zone, there is no change to the time.
    Do you have any suggestions how to get the computer to recognize the change in time zone?
    Thanks.

    I should add that if I select the box to set date and time automatically, the computer displays a time completely unrelated to the time zone I've selected - this time does not change depending on the time zone selected.

  • Oracle 8i - select between to date ranges, but exculde time ranges

    Hi, I'm using Oracle 8i
    I'm trying to select a set of records that are between a certain date time (say between October 15 at 6pm and October 17 at 6am) and then want to include only those records that fall between 6am and 6pm within the range.
    I've tried extract and trunc function and can't seem to get it to work.
    If I do a trunc to try to pull out only hour, it returns all of the date information as well:
    SQL> select trunc(to_date('14-10-2007 02:43:46','DD-MM-YYYY HH24:MI:SS'),'HH24') from dual;
    TRUNC(TO_DATE('14-10
    14-OCT-2007 02:00:00
    SQL>Any Ideas? Here is some sample data:
    select * from
            select to_date('14-10-2007 02:43:46','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 03:02:50','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:13:16','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:16:04','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:18:26','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:20:25','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:22:35','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:23:59','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:26:30','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:33:30','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:54:36','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 15:56:11','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('14-10-2007 18:56:52','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('15-10-2007 09:12:38','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('15-10-2007 10:23:42','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('15-10-2007 11:17:32','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('15-10-2007 11:46:12','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('15-10-2007 12:36:22','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('15-10-2007 23:23:17','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('16-10-2007 14:43:06','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('16-10-2007 14:44:37','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('16-10-2007 14:48:17','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('16-10-2007 14:49:36','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('16-10-2007 15:07:05','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('16-10-2007 15:08:24','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 08:55:33','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 09:58:19','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 15:07:16','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 15:19:35','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 15:58:32','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 19:56:51','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 21:22:49','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 22:16:52','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('17-10-2007 22:45:51','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('18-10-2007 07:52:10','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('18-10-2007 07:54:15','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('18-10-2007 08:03:57','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('18-10-2007 08:31:27','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('18-10-2007 09:16:14','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('18-10-2007 11:10:55','DD-MM-YYYY HH24:MI:SS') from dual union all
            select to_date('18-10-2007 11:21:57','DD-MM-YYYY HH24:MI:SS') from dual
    ) DataSet

    If you can subtract date types from each other in 8i (I think you can but don't know for sure) you can use this:select dte, (dte-trunc(dte))*24 hours
    from (SELECT TO_DATE('15-10-2007 05:59:59',    'DD-MM-YYYY HH24:MI:SS') DTE FROM DUAL UNION ALL
       SELECT TO_DATE('15-10-2007 06:00:00',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('15-10-2007 06:00:01',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('15-10-2007 17:59:59',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('15-10-2007 18:00:00',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('15-10-2007 18:00:01',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('16-10-2007 05:59:59',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('16-10-2007 06:00:00',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('16-10-2007 06:00:01',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('16-10-2007 17:59:59',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('16-10-2007 18:00:00',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('16-10-2007 18:00:01',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('17-10-2007 05:59:59',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('17-10-2007 06:00:00',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('17-10-2007 06:00:01',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('17-10-2007 17:59:59',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('17-10-2007 18:00:00',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL UNION ALL
       SELECT TO_DATE('17-10-2007 18:00:01',    'DD-MM-YYYY HH24:MI:SS') FROM DUAL
       ) t
    where dte between TO_DATE('15-10-2007 18:00:00',    'DD-MM-YYYY HH24:MI:SS')
                  and TO_DATE('17-10-2007 06:00:00',    'DD-MM-YYYY HH24:MI:SS')
          and (dte-trunc(dte))*24 between 6 and 18
    DTE                       HOURS                 
    15-OCT-2007 18.00.00      18                    
    16-OCT-2007 06.00.00      6                     
    16-OCT-2007 06.00.01      6.00027777777777777777777777777777777778
    16-OCT-2007 17.59.59      17.99972222222222222222222222222222222222
    16-OCT-2007 18.00.00      18                    
    17-OCT-2007 06.00.00      6                     
    6 rows selected

  • Handling DATE and TIME in SELECT Statment

    Hey pros,
    I have this problem where I want to execute a select query based on date and time, but I want it to be handled in such a way which is better explained with this example:
    User enters a date range of Apr. 10 and Apr. 12
    User enters a time range of 9:00am - 10:00am
    The results I want would be from April 10 9:00am to Apr. 12 10am.
    The way I have it working today is that it shows me all data from Apr. 10-12 from 9am-10am on all days.
    Is there an easy way to do this?
    Here is my code (see the 3rd last and 2nd last line)  Thanks!
    SELECT vepowerks vepolgort vepo~matnr
              mara~mtart
              vepovenum vepovepos
              vekperdat vekperuhr vekpstatus vekpexidv
              "gc_bwart as bwart
              vepovemng vepovemeh
              vepo/cwm/vemng vepo/cwm/vemeh
        INTO CORRESPONDING FIELDS OF TABLE gt_tran
    INTO CORRESPONDING FIELDS OF TABLE itab
        FROM vepo
          INNER JOIN vekp ON
              vepovenum = vekpvenum
          INNER JOIN mara ON
              vepomatnr = maramatnr
        WHERE
              vepo~werks = p_werks    AND
              vepo~lgort IN s_lgort   AND
              vepo~matnr IN s_matnr   AND
              vepo~bestq = gc_bestq   AND
              NOT ( vepovemng = 0 AND vepo/cwm/vemng = 0 ) AND
              vekp~status = gc_status AND
              vekp~erdat IN s_erdat   AND
              vekp~eruhr IN s_eruhr   AND
              mara~mtart IN s_mtart.

    I think you might just have to select the date range, then do a loop and read table.
    select xx where date in date_range from x into table y.
    loop at y into wa_y.
      if wa_y-date = lower_date_limit. "this day has the 9am limit
        "only pick those records that have wa_y-time GE 9am.
        <your logic here>
      elseif wa_y-date = upper_date_limit. "this day has teh 12pm limit
        "only pick those records that have wa_y-time LE 12pm.
        <your logic here>
      else. "every day in between the dates
        "get all data no matter what the time is
        <your logic here>
      endif.
    I honestly don't know if there is a select-where clause that will do this automatically, but the above solution should work..hope this helps.
    --Juan
    Edited by: takeabyte on Apr 29, 2010 8:36 PM

  • Discrete time range over date range  (using CR X1)

    Post Author: sjr
    CA Forum: Formula
    Can anyone show me how to select data over a discrete time range i.e. 6 p.m. till 11 p.m. per day, over a period of a month ?
    Using the data time parameter gives me data from 6p.m. on startdate right through till 11p.m. on endate.

    Here's a more detailed description...
    Create two formula fields to split the date and time from the data records (ds prefixed):
    dsDate
    dsTime
    Create two formula fields to split the date and time from the parameter fields (pm prefixed):
    pmStartDate
    pmStartTime
    pmStartDate
    pmStartTime
    Use your new formula fields in the record selector. Get to this off the Report menu button (in CR 2008):
    Report | Select Expert... | Record.
    You can pick the formula fields in the Forumula Editor to create something like:
    ({@dsDate} > {@pmStartDate} and
    {@dsDate} < {@pmEndDate}) and
    ({@dsTime} > {@pmStartTime} and
    {@dsTime} < {@pmEndTime)
    Tim

  • Date Range Selection in Query Templates

    Hi,
    Can someone please tell me how to use <b>Date Range Selection</b> Tab details in SQL Query and TAG Query (Using Examples).
    Thanks in advance
    Muzammil P.T

    >>>>>>>>>>
    Re: Date Range Selection in Query Templates   
    Posted: Feb 15, 2007 6:43 AM    in response to: Muzammil Ahamed       Reply      E-mail this post 
    Hi Muzammil,
    In data range section you can have multiple options like setting start datetime and end datetime.. And you can set the shift (or) time period and also the format of the time periods.
    Primarily we use the start date and end date querying to fetch data between two time labels. I can explain this one with example..
    You have batch production table with columns Production Time, Batch Id, Production Qty. Then you want all the details between the 02/02/2007 to 05/02/2007.
    Solution :
    1.Map 02/02/2007 with Start date.
    2.Map 05/02/2007 with end dare.
    Now these two become the variables [SD] and [ED].
    Now you have mentioned the date range, but you need to mention for which column these things to be applied. For that
    3.In Query tab enter Production Time column name in Date column at the bottom.
    Now you have written query like Select * from batch prodcution where production time > 02/02/2007 and production time < 05/02/2007.
    4. Even those values you mapped (SD and ED) you can change from the front page through Java script.
    Like wise you have so many other advantages also.
    If you have any other specific doubt let me know.
    Thanks,
    Rajesh.
    PS : Please ward points if answer is useful. <<<<<<<<
    Message was edited by:
            David Dreyer

Maybe you are looking for

  • I can't email my Pages documents anymore.

    I have shared my Pages documents in the past via email (either in Pages, Word or PDF) with no problem, but suddenly it's not working.  I did do a software update today... wondering if that could have somehow affected it?  I am 10.6.8, I know, it's ol

  • Sony SDM Display

    I am planning on buying one of the following three SONY displays for my new (still in box) Mac Mini with an Intel Core Solo processor. I need to know whether this will work with the mac (I've heard that I need to check and make sure that the video ca

  • Planning dependent and independent requirements in DP

    Hi,       We have a material A here that has a BOM defined. The components of the BOM are all dependent on the initial material. There are some cases where theBOM is recursive, meaning that the components of BOM could include material A. Now, I also

  • Web Part Title Bar image

    I can't believe no one has asked about this, but my search came up empty. How does one change the tiny (16x16) image on the Web Part Title Bar? I see where to set the title, but not the image.

  • Viewing Properties - Character Section - Can't see right arrow to view all fonts

    I am using Captivate 6. I have the properties window open, and would like to change the font. I can not see the arrow on the right of the field. It is cut off with the scroll bar.