Display date range with given week no

Can anyone please suggest on how to display Date range when wek no is given in APEX 4.0.2?
Example: given week no as 20 then I need to show week_start_date as 7/18/2011 and week_end_date as 7/25/2011 .
Thanks

maybe this could help you on the way to a solution:
with dates as
    ( select dat, to_char(dat+1, 'iw') week
    from (select to_date('01-01-2011', 'DD-MM-YYYY') + rownum dat
    from all_objects)
    where rownum < 1000)
select week, min(dat), max(dat)
from dates
where week = 20
group by week
order by week;You have to check which format for week you want to use: WW (first week starts at the 1st of January) IW (ISO week number)
see also: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:7482139067917

Similar Messages

  • Date for a given Week

    how can i get the start date and end date for a given week
    like if i give week no. 28 then it will return the dates of the week like
    start date = 10-07-2006
    end date   = 16-07-2006.
    abhishek

    Hi,
    You can use the FM <b>GET_WEEK_INFO_BASED_ON_DATE</b>
      Import parameters               Value           
      DATE                            07/13/2006                                                                               
    Export parameters               Value           
      WEEK                            200628          
      MONDAY                          07/10/2006      
      SUNDAY                          07/16/2006      
    Regards
    vijay

  • DATE FROM THE GIVEN WEEK NUMBER AND YEAR

    hi to all
    With weeknr, yearnr  i need to find STARTDATE  (first day of the week), ENDDATE (last day of the week) The first day of the week is always a Monday.
    example 44 2007
    week nr is 44
    year is 2007
    how to find it.
    is there any standard function module to find.
    regards
    prathap

    hi prathap,
    WEEK_GET_FIRST_DAY For a given week (YYYYMM format), this function returns the date of the Monday of that week.
    try using this function module...
    some other function modules may be helpful...
    DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
    DATE_GET_WEEK will return the week that a date is in.
    DATE_IN_FUTURE Calculate a date N days in the future.
    DAY_ATTRIBUTES_GET Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday, and more.
    reward if helpful
    regards,
    sravanthi.

  • Compute Date Range with SQL Statement

    I'm sure there is a way to do this in SQL, but I cannot figure it out. I can write a PL/SQL script to do it, but would prefer using a SQL Statement. My database is Oracle Database 10.2.0.4.0.
    I have a table that contains information such as the employee number, department id, and the effective date of when the person started in that department. There is data in another table that I want to update their department number in based on their effective date range. If I could figure out how to select the effective date range correctly, I can do the rest.
    I have data such as:
    EMP_ID DEPT_NO EFFECTIVE
    101 1000 1/15/2001
    101 1050 5/24/2005
    101 2010 6/8/2008
    101 1000 8/2/2010
    I want to write a SELECT statement that returns something like this where the END_DATE is the day before the EFFECTIVE date and the last record does not have an END_DATE because they are still assigned to that department. Also, the first record in the column, I don't want to select a DEPT_NO because the effective date logic was added in January 2001 so if a person started back in 1985 they could have switched departments zero to many times so I'm not going to update any data for that period:
    EMP_ID DEPT_NO EFFECTIVE END_DATE
    101 1/14/2001
    101 1000 1/15/2001 5/23/2005
    101 1050 5/24/2005 6/7/2008
    101 2010 6/8/2008 8/1/2010
    101 1000 8/2/2010
    Below is a script to create the data in a temp table that can be used to write a SELECT statement on. I have added two employee records with different dates.
    create table temp_activity
    (emp_id number(12),
    dept_no number(12),
    effective date);
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1000,to_date('1/15/2001','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1050,to_date('5/24/2005','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,2010,to_date('6/8/2008','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1000,to_date('8/2/2010','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (102,1040,to_date('1/15/2001','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (102,2000,to_date('6/16/2006','MM/DD/YYYY'))
    Any help is appreciated. This is probably easy, but I cannot get my brain wrapped around it.
    Thanks - mike

    select  emp_id,
            dept_no,
            effective,
            end_date
      from  (
              select  emp_id,
                      dept_no,
                      effective,
                      lead(effective) over(partition by emp_id order by effective) - 1 end_date,
                      row_number() over(partition by emp_id order by effective) rn
                from  temp_activity
             union all
              select  emp_id,
                      null dept_no,
                      null effective,
                      min(effective) - 1 end_date,
                      0 rn
                from  temp_activity
                group by emp_id
      order by emp_id,
               rn
        EMP_ID    DEPT_NO EFFECTIVE  END_DATE
           101                       01/14/2001
           101       1000 01/15/2001 05/23/2005
           101       1050 05/24/2005 06/07/2008
           101       2010 06/08/2008 08/01/2010
           101       1000 08/02/2010
           102                       01/14/2001
           102       1040 01/15/2001 06/15/2006
           102       2000 06/16/2006
    8 rows selected.
    SQL> SY.

  • Date Ranges with EOMONTH

    Hi I'm look
    for a date ranges query, any help would be greatly appreciated<o:p></o:p>
    Ie
    01/06/2014 to 30/06/2014<o:p></o:p>
    SELECT
    count(DISTINCT[Form Number]) as OutofFunding
    FROM [dbo].[NEWVIEW]
    WHERE [Cohort Desc] IN ('Apprenticeships')
    AND [Expected End] > EOMONTH(GETDATE(), -1) <o:p></o:p>

    Here is how you can do datetime range with EOMONTH:
    SELECT Count(DISTINCT[form number]) AS OutofFunding
    FROM [dbo].[newview]
    WHERE [cohort desc] IN ( 'Apprenticeships' )
    AND [expected end] > Eomonth(Getdate(), -1)
    AND [expected end] < Dateadd(dd, 1, Eomonth(Getdate(), 4));
    BLOG on datetime ranges:
    http://www.sqlusa.com/bestpractices2008/between-dates/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Data between Date Range with Business Days only

    Hi All,
    We have a requirement that we need to retrieve data between a data range, providing From date and To date as input.
    We also have the option to Include Business Days Only through a check box which will be passed to CR 2008 through a report frame work.
    Can some one help me how to display the report data within the Date Range entered and that includes only Business Days.
    Thanks in advance for the help.
    Regards,
    Naresh.

    try this formula. Lets if your date range parameter is {?date} then try this formula
    @startdate:
    if datepart('w',minimum({?date}))=7 then
    minimum({?date})+2
    else if datepart('w',minimum({?date}))=1 then
    minimum({?date})+1
    else
    minimum({?date})
    @enddate
    if datepart('w',maximum({?date}))=7 then
    maximum({?date})+2
    else if datepart('w',maximum({?date}))=1 then
    maximum({?date})+1
    else
    maximum({?date})
    regards,
    Raghavendra

  • Date ranges with OLE DB

    Post Author: georgeb
    CA Forum: Data Connectivity and SQL
    Does anyone know if the issue with date ranges in OLE DB reports using Visual Foxpro databases has been resolved in Crystal Reports 10?
    Currently all OLE DB reports that use date ranges crash with:
    Failed to open a rowset.Details: ADO Error Code: 0x80004005Source: Microsoft OLE DB Provider for Visual FoxProDescription: SQL: Column 'DATETIME' is not foundNative Error: 806We referred this to Business Objects some time ago and their comment was that they do not supportVisual FoxPro ...
    Any assistance would be appreciated.

    Here is how you can do datetime range with EOMONTH:
    SELECT Count(DISTINCT[form number]) AS OutofFunding
    FROM [dbo].[newview]
    WHERE [cohort desc] IN ( 'Apprenticeships' )
    AND [expected end] > Eomonth(Getdate(), -1)
    AND [expected end] < Dateadd(dd, 1, Eomonth(Getdate(), 4));
    BLOG on datetime ranges:
    http://www.sqlusa.com/bestpractices2008/between-dates/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Date picker with 1 week range

    Hi,
    i  would like to develop an application that shows a navigation possibility to move one week back or forward. Under this control is a kind of calendar that shows one week. A click on the day selects the date.
    If you take a look at the image http://scn.sap.com/servlet/JiveServlet/showImage/102-31625-11-218124/sapui5%40sapfiori.png you can see in the middle the controls that I mean . The onliest difference is that they have two weeks and I would like to have one week.
    What is the name of the control to navigate back and forward for the weeks?
    How to make a calendar that displays just one week?
    It would be great if someone could bring some light into the darkness.
    Thank you, Vanessa

    I've created a simple example, the important config is singleRow, weeksPerRow and SingleRow.
      monthsPerRow: 1,
      weeksPerRow: 1,
      singleRow: true
    http://jsbin.com/peyaw/1/edit
    Regards,
    Jason

  • Date from the given week nr and year

    hi to all
    With weeknr, yearnr i need to find STARTDATE (first day of the week), ENDDATE (last day of the week) The first day of the week is always a Monday.
    example 44 2007
    week nr is 44
    year is 2007
    how to find it.
    is there any standard function module to find.
    regards
    prathap

    Hello Pratap,
    Please check the function module 'VELO03_WEEK_OR_MONTH_TO_DATE'.
    I also wrote a demo program to test it.
    PARAMETER: p_week  TYPE vlc_week DEFAULT '01',
               p_gjahr TYPE gjahr.
    DATA: v_dat1 TYPE sy-datum, "Start Date
          v_dat2 TYPE sy-datum. "End Daye
    CALL FUNCTION 'VELO03_WEEK_OR_MONTH_TO_DATE'
      EXPORTING
       week_iv             = p_week
        year_iv             = p_gjahr
    IMPORTING
       date_ev             = v_dat1
    EXCEPTIONS
       week_invalid        = 1
       month_invalid       = 2
       OTHERS              = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    v_dat2 = v_dat1 + 5. "Assuming Saturday is the last day
    WRITE: v_dat1, / v_dat2.
    Hope this helps. Award points if helpful.
    Thanks & Regards,
    Suhas.
    PS: You can also use the FM 'WEEK_GET_FIRST_DAY'.
    Edited by: Suhas Saha on Jan 2, 2008 8:08 AM

  • Dvt:schedulingGantt : to show current date directly with the week

    Hello everyone,
    i use Jdeveloper 11g and ADF.
    I use this component: "dvt:schedulingGantt" and
    Q1: I would like to know if I can show directly when I'm going on this page the current week.
    Q2: Is it possible to put on "Start time" field the current date minus one month? and "End time" field the current date plus one year?
    Thank you
    Regards

    Are you sure you haven't committed one of the cardinal sins of the Java-ignorant by confusing it with Javascript?

  • Monday's Date  of the given week  and year

    Hi gurus,
    I have the data for week ( eg.52 ) and year ( eg. 08 ) and I need to get the date of the Monday of that week (21-DEC-2008...i.e 52th week of 2008 Year.)
    Pls let me knw the sql statement solution for this ..
    THanks,
    shashi..

    Hi, Shashi,
    There's a bug in what I posted before.
    Do this instead:
    TRUNC ( TO_DATE ( '01-Jul-' || :year_txt
                    , 'DD-Mon-YYYY'
          , 'IY'
          ) + (7 * (:week_val - 1))The only change is in TO_DATE.
    Here's the problem.
    TO_DATE won't work with ISO years; it only takes calendar years.
    When you don't specify a day and month in TO_DATE (like I originally did) it defaults to the first day of the current month. So TO_DATE ('2011', 'YYYY') returns October 1, 2011 when the current month is October, and it returns January 1, 2011 when the current month is January.
    January 1, 2011, however, is in ISO year 2010. (ISO 2011 begins on the Monday closest to January 1, which is January 3, 2011). My original solution, therefore, would return dates from ISO year 2010 when anyone asked for year 2011 and they happend to be running the program during January.
    Specifying a full date makes the expression behave the same regardless of when it is run.

  • Return date for a given week number in a month

    Hi,
    Can someone urgently post a snippet code that will return the date if the week number and the weekday (like wednesday) for a given month in an year is passed.
    ex: If I say 2nd wednesday of August in 2004 , it must return the date for second wednesday. URGENT

    Don't flag your question as urgent, even if it is for you. Claiming urgency is very likely to be counter-productive: most forum regulars will simply ignore such messages as rude and selfish attempts to elicit immediate and special attention.
    Besides, unless the Symbionese Liberation Army is about to chase you over the edge of a cliff, your problem probably isn't as urgent as you think. :o)

  • How to get date range of Current week

    Hi Gurus,
    I need to create report of current(this) week manual bills created by one user. I have date Field called CREAT_DATE.Based on this date column i need to create report.
    Could anybody help to get this query.
    Example:
    select .....
    from ....
    where
    CREAT_DATE
    Thank You
    Vikram

    It kind of depends on your definition of "current week". If you mean something like the last 7 days, then
    SELECT columns
    FROM table
    WHERE creat_date BETWEEN TRUNC(sysdate - 7) and TRUNC(sysdate +1)would do it.
    If you mean Monday until today, then:
    SELECT columns
    FROM table
    WHERE creat_date BETWEEN NEXT_DAY(TRUNC(sysdate - 7), 'MONDAY') and TRUNC(sysdate +1)Read up on the various date functions for other possibilities.
    TTFN
    John

  • Selecting missing date range with previous records value

    Hello,
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SET DEFINE OFF;
    create table t(NBR_OF_S number, NBR_OF_C number, S_DATE date);
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (34, 40, TO_DATE('05/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (27, 29, TO_DATE('03/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (21, 23, TO_DATE('12/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (19, 20, TO_DATE('10/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (18, 19, TO_DATE('09/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (17, 17, TO_DATE('08/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (16, 16, TO_DATE('06/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (9, 9, TO_DATE('12/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (5, 5, TO_DATE('11/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (2, 2, TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    SQL> select * from t order by 3 desc;
      NBR_OF_S   NBR_OF_C S_DATE
            34         40 01-MAY-12
            27         29 01-MAR-12
            21         23 01-DEC-11
            19         20 01-OCT-11
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-JAN-10
    10 rows selected.I want the output like as follows, all those missing date i need to carry on the last one's number
      NBR_OF_S   NBR_OF_C S_DATE
            34         40 01-MAY-12
            27         29 01-APR-12
            27         29 01-MAR-12
            21         23 01-FEB-12
            21         23 01-JAN-12
            21         23 01-DEC-11
            19         20 01-NOV-11
            19         20 01-OCT-11
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUL-11
            16         16 01-JUN-11
             9          9 01-MAY-11
             9          9 01-APR-11
             9          9 01-MAR-11
             9          9 01-FEB-11
             9          9 01-JAN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-OCT-10
             2          2 01-SEP-10
             2          2 01-AUG-10
             2          2 01-JUL-10
             2          2 01-JUN-10
             2          2 01-MAY-10
             2          2 01-APR-10
             2          2 01-MAR-10
             2          2 01-FEB-10
             2          2 01-JAN-10Any help would be greatly appreciate.
    Note: The date value I have created for this sample is monthly, based on the condition the data value I may need to generate weekly also. That's Monthly or weekly either one
    Thanks,

    And what is AMT? You didn't provide such column in your original post. Anyway, MODEL solution based on original post:
    select  nbr_of_s,
            nbr_of_c,
            s_date
      from  t
      model
        partition by(rowid)
        dimension by(1 d)
        measures(
                 nbr_of_s,
                 nbr_of_c,
                 s_date,
                 months_between(lag(s_date) over(order by s_date desc),s_date) cnt
        rules(
              nbr_of_s[for d from 1 to cnt[1] increment 1] = nbr_of_s[1],
              nbr_of_c[for d from 1 to cnt[1] increment 1] = nbr_of_c[1],
                s_date[for d from 1 to cnt[1] increment 1] = add_months(s_date[1],cv(d) - 1)
      order by s_date desc
      NBR_OF_S   NBR_OF_C S_DATE   
            34         40 01-MAY-12
            27         29 01-APR-12
            27         29 01-MAR-12
            21         23 01-FEB-12
            21         23 01-JAN-12
            21         23 01-DEC-11
            19         20 01-NOV-11
            19         20 01-OCT-11
      NBR_OF_S   NBR_OF_C S_DATE   
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUL-11
            16         16 01-JUN-11
             9          9 01-MAY-11
             9          9 01-APR-11
             9          9 01-MAR-11
             9          9 01-FEB-11
      NBR_OF_S   NBR_OF_C S_DATE   
             9          9 01-JAN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-OCT-10
             2          2 01-SEP-10
             2          2 01-AUG-10
             2          2 01-JUL-10
             2          2 01-JUN-10
      NBR_OF_S   NBR_OF_C S_DATE   
             2          2 01-MAY-10
             2          2 01-APR-10
             2          2 01-MAR-10
             2          2 01-FEB-10
             2          2 01-JAN-10
    29 rows selected.
    SQL> SY.
    Edited by: Solomon Yakobson on Jun 11, 2012 1:34 PM

  • Export Mail to pst between date range with Messagekind eq Email

    Exchange 14.2 247.5
    I am trying to export all mail from a piped list of mailboxes but only between two dates. I can do one or the other, but not combine both contentfilters - can anyone offer any advice as to what I'm doing wrong? I've played with different combinations of
    brackets but I can't get it do do an -and for some reason. My spreadsheet has columns for alias and pstpath - this part is fine, I just can't get it to evaulate both contentfilters. My short script:
    foreach ($i in (Import-Csv c:\temp\export\mailtest.csv)) { 
    New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {(Received -lt '07/18/2014') -and (Received -gt '06/18/2014')} {MessageKind -eq Email}
    I'm also running a script to shift all calendars and contacts (not date limited) to pst but am running this seperately. If these can be combined then great, but I'm happy to run two commands.
    THanks
    James.

    No joy still with that either. Running Get-MailboxExportRequestStatistics -Identity MaibloxName\MailboxExport
    -IncludeReport | Format-List gives the error message:
    AssociatedMessagesCopyOption  : DoNotCopy
    BatchName                     :
    ContentFilter                 : ((((Received -lt '18/07/2014 12:00:00 AM') -and (Received -gt '18/06/2014 12:00:00 AM')
                                    )) -and (MessageKind -eq 'Email'))
    ContentFilterLanguage         :
    BadItemLimit                  : 0
    BadItemsEncountered           : 0
    QueuedTimestamp               : 19/07/2014 3:18:11 PM
    StartTimestamp                :
    LastUpdateTimestamp           : 19/07/2014 3:18:15 PM
    CompletionTimestamp           :
    SuspendedTimestamp            :
    OverallDuration               : 00:00:15
    TotalSuspendedDuration        :
    TotalFailedDuration           : 00:00:12
    TotalQueuedDuration           : 00:00:03
    TotalInProgressDuration       : 00:00:00
    TotalStalledDueToHADuration   :
    TotalTransientFailureDuration :
    MRSServerName                 :
    EstimatedTransferSize         : 0 B (0 bytes)
    EstimatedTransferItemCount    : 0
    BytesTransferred              : 0 B (0 bytes)
    BytesTransferredPerMinute     :
    ItemsTransferred              : 0
    PercentComplete               : 0
    PositionInQueue               :
    FailureCode                   : -2146233088
    FailureType                   : InvalidContentFilterPermanentException
    FailureSide                   :
    Message                       : Error: ContentFilter is invalid. The value "18/07/2014 12:00:00 AM" could not be conver
                                    ted to type System.DateTime. --> The value "18/07/2014 12:00:00 AM" could not be conver
                                    ted to type System.DateTime.
    FailureTimestamp              : 19/07/2014 3:18:15 PM
    FailureContext                :
    I am in AU using English (australia) and so using dd/mm/yyyy short date format but understand that this is irrelevant and we use mm/dd/yyyy for powershell operations. 
    The command I am using is:
    New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {((Received -lt '07/18/2014') -and (Received -gt '06/18/2014') -and (MessageKind -eq "Email"))}
    I don't understand why this is failing...

Maybe you are looking for