Get week ending date from Year and Week Number

I would like to display the week ending date in a Report.
My dataset query has grouped the results by year and week number, so I am trying to construct the week ending date from year and week number.

Week end date can be got as below
=DateAdd(DateInterval.WeekOfYear,CInt(Fields!WeekNumber.Value) -1,DateAdd(DateInterval.Year,(Cint(Fields!Year.Value) - 1900),CInt("12/31/1899")))
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Find date if year, month, week and day is given

    Hi,
    How to find the date, if year, month, week and day is given?
    For example:
    Given, year - 2010, month - 03, Day - Wednesday, Week - 3,
    Then how can we get the date as 17-Mar-2010.
    Thanks,
    Chris

    with dt_tbl as (
                    select  2010 year,
                            3 month,
                            3 week,
                            'Wednesday' day
                      from  dual
    select  trunc(to_date(year || '-' || month || '-01','yyyy-mm-dd'),'iw') + (week - 1) * 7 +
              case day
                when 'Monday' then 0
                when 'Tuesday' then 1
                when 'Wednesday' then 2
                when 'Thursady' then 3
                when 'Friday' then 4
                when 'Saturday' then 5
                when 'Sunday' then 6
              end dt
      from  dt_tbl
    DT
    17-MAR-10
    SQL> SY.

  • Monday Date from Year Week

    Is there a way to derive the date for a Monday given the Year and Week. For example, given 200723 the result would be 06/04/2007.
    Jeff

    SQL> select param,
      2         next_day(to_date(substr(param,1,4)||'0101','YYYYMMDD')-decode(to_char(to_date(substr(param,1,4)||'0101','YYYYMMDD'),'IW'), 1,7,0),'MONDAY')
      3         + (7*to_number(substr(param,5)-1)) output
      4  from (select 200723 as param from dual
      5        union all
      6        select 200701 as param from dual
      7        union all
      8        select 200752 as param from dual
      9        union all
    10        select 200623 as param from dual
    11        union all
    12        select 200601 as param from dual
    13        union all
    14        select 200652 as param from dual);
        200723 04-JUN-07
        200701 01-JAN-07
        200752 24-DEC-07
        200623 05-JUN-06
        200601 02-JAN-06
        200652 25-DEC-06
    6 rows selected.
    SQL> Nicolas.

  • Function module to derive start and end dates from fiscal year and period.

    Hi,
    I want to know a function module to derive start and end dates from fiscal year and period.
    ie: If I have say fiscal year '2010' and period '07', then the start date of this period would be '01.10.2010'.
    Thanks.
    Moderator Messge: Basic Date questions are not allowed.
    Edited by: kishan P on Oct 18, 2010 4:45 PM

    Hi,
    This is one of my exit that display the calmonth (offset -12). Usefull when I have to retrieve in a KF a complete rolling year depending one calmonth.
    S_VMUCMN is my selection variable
    S_TXTCMN_M12 is my text variable calmonth-12
    S_TXTCMN_M0 is my text variable for selected calmonth.
    WHEN 'S_TXTCMN_M12'.
        IF i_step = '2'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'S_VMUCMN'.
            CLEAR l_s_range.
            " First day of the selected month
            CONCATENATE loc_var_range-low '01' INTO l_calday.
            CALL FUNCTION 'YFRBW_FUM_CAL_DATE_IN_INTERVAL'
              EXPORTING
                date      = l_calday
                months    = 12
                signum    = '-'
              IMPORTING
                calc_date = l_calday.
            l_s_range-low = l_calday+0(6).
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    Thus, in KF header you have to put the two text variable to display the complete period.
    Hope it helps,

  • Grouping Via Week Ending Date

    Hi All,
    I have transaction line data for each day for our customer and i would like to group via Week Ending date.  Our week runs from Sunday to Saturday.
    If i Add the transaction date to the group expert it allows me to group via week(perfect) but does it via week commencing.  I see you can group via formula, does any one know how you can get the grouping via Week Ending.
    thanks for any help and advise.
    mike

    Try using this formula...
    DateAdd("ww", DateDiff("ww", #1/6/1900#, {TableName.DateField}), #1/6/1900#)
    This formula will calculate the "Following Saturday" for any given date. If the date supplied is a Saturday, it will return that same date.
    So...
    11/2/2010 > 11/6/2010
    11/13/2010 > 11/13/2010
    11/14/2010 > 11/20/2010
    HTH,
    Jason

  • Week End Date calculates dates in table issues

    Greetings All,
    I'm working on a LiveCycle Designer ES4 document that has a Week Ending Date MM-DD-YYYY (which need to always be a Saturday) selected in a subform.
    I need this Week End Date to then calculate and display the selected Saturday and the previous days in a seperate subform with a table. The days need to display in seperate columns below the header.
    This is what I have so far:
      TopmostSubform.Page1.Requestor.WeekEndDate::exit - (FormCalc, client)
    var endDate = Date2Num($,"MM-DD-YYYY")
    var dayOfWeek = Num2Date(endDate, "E")
    if (dayOfWeek <> 7) then
       xfa.host.messageBox("Ending date must be a Saturday")
       $ = null
       xfa.host.setFocus("$")
    endif
    Page1.#subform[1].InputTable.Row1[0].Date7 = Num2Date(endDate - 0, "DD")
    Page1.#subform[1].InputTable.Row1[0].Date6 = Num2Date(endDate - 1, "DD")
    Page1.#subform[1].InputTable.Row1[0].Date5 = Num2Date(endDate - 2, "DD")
    Page1.#subform[1].InputTable.Row1[0].Date4 = Num2Date(endDate - 3, "DD")
    Page1.#subform[1].InputTable.Row1[0].Date3 = Num2Date(endDate - 4, "DD")
    Page1.#subform[1].InputTable.Row1[0].Date2 = Num2Date(endDate - 5, "DD")
    Page1.#subform[1].InputTable.Row1[0].Date1 = Num2Date(endDate - 6, "DD")
    However I keep getting an error on the WeekEndDate when selecting a Saturday.
    Does anyone have any idea what I'm doing wrong?
    Thank you for any help!
    -Michelle

    Well, I never got an answer from the forum here, but to help out others - here is what I did:
    This was all done in FormCalc.
    The object WeekEndDate Date/Time Field has a set pattern date{MM/DD/YYYY} in the Object Field Pattern in LiveCycle.
    BUT, the Scripting required the pattern to be YYYY-MM-DD
    Why? I have no flipping clue. It won't work any other way for me.
    Also this item requires a Saturday Date to be chosen. Days of the week are designated by numbers (Sunday = 1, Monday = 2, etc.)
    The line <>7 means that if the day is not Saturday (7) then the error message "Ending date must be a Saturday" will appear.
    This is the Exit event Script:
    TopmostSubform.Page1.Requestor.WeekEndDate::exit- (FormCalc, client)
    var endDate = Date2Num($,"YYYY-MM-DD")
    var dayOfWeek = Num2Date(endDate, "E")
    if (dayOfWeek <> 7) then
         xfa.host.messageBox("Ending date must be a Saturday")
         $ = null
         xfa.host.setFocus("$")
    endif
    The individual Date cells are set to a Date/Time Field with no pattern set in the Object Field Pattern in LiveCycle.
    The coding below designates a MM/DD pattern.
    Each individual field has it's own scripting, with the appropriate minus calculation  - #
    This is the Calculate script for the Sunday cell:
    TopmostSubform.Page1.#subform[1].InputTable.Row1[0].Date1::calculate - (FormCalc, client)
    var dateNum = date2num(TopmostSubform.Page1.Requestor.WeekEndDate.formattedValue,"MM/DD/YYYY") - 6
    $.rawValue = num2date(dateNum,"MM/DD")
    And the Saturday cell, that needed to display the Saturday End Date has the following Script, with NO minus number:
    TopmostSubform.Page1.#subform[1].InputTable.Row1[0].Date7::calculate - (FormCalc, client)
    var dateNum = date2num(TopmostSubform.Page1.Requestor.WeekEndDate.formattedValue,"MM/DD/YYYY")
    $.rawValue = num2date(dateNum,"MM/DD")
    Why did I include this all here?
    Because this whole project has been gawd-awful, and hopefully these insights can help another struggle forms designer understand the FormCalc scripting used.
    -M

  • Week Ending Dates Logic....

    Hi All,
    I need to do a Count(measure) group by a week .
    Week is defined as should contain the "end of the each week" values.
    I tried:
    to_char(trunc(to_date(INPUT_DT,'YYYYMMDD'),'W')+7,'MM/DD/YYYY')
    but i get the wrong week ending dates? Any ideas?
    I get the values as:
    2/05/08,
    2/08/08,
    2/15/08,
    2/22/08,
    2/29/08,
    3/07/08,
    3/08/08,
    3/15/08,
    3/22/08.
    Message was edited by:
    user521009

    I need to do a Count(measure) group by a week .
    Week is defined as should contain the "end of the
    each week" values.
    Maybe this could help:
    test@ORA10G>
    test@ORA10G> -- this query displays the end date of each week in the current year
    test@ORA10G>
    test@ORA10G> select
      2    to_char(trunc(sysdate,'yyyy')+level-1,'ww') as week_number,
      3    max(trunc(sysdate,'yyyy')+level-1) as end_date
      4  from dual
      5  connect by level <= trunc(add_months(sysdate,12),'yyyy') - trunc(sysdate,'yyyy')
      6  group by to_char(trunc(sysdate,'yyyy')+level-1,'ww')
      7  order by to_number(to_char(trunc(sysdate,'yyyy')+level-1,'ww'))
      8  /
    WE END_DATE
    01 07-JAN-08
    02 14-JAN-08
    03 21-JAN-08
    04 28-JAN-08
    05 04-FEB-08
    06 11-FEB-08
    07 18-FEB-08
    08 25-FEB-08
    09 03-MAR-08
    10 10-MAR-08
    11 17-MAR-08
    12 24-MAR-08
    13 31-MAR-08
    14 07-APR-08
    15 14-APR-08
    16 21-APR-08
    17 28-APR-08
    18 05-MAY-08
    19 12-MAY-08
    20 19-MAY-08
    21 26-MAY-08
    22 02-JUN-08
    23 09-JUN-08
    24 16-JUN-08
    25 23-JUN-08
    26 30-JUN-08
    27 07-JUL-08
    28 14-JUL-08
    29 21-JUL-08
    30 28-JUL-08
    31 04-AUG-08
    32 11-AUG-08
    33 18-AUG-08
    34 25-AUG-08
    35 01-SEP-08
    36 08-SEP-08
    37 15-SEP-08
    38 22-SEP-08
    39 29-SEP-08
    40 06-OCT-08
    41 13-OCT-08
    42 20-OCT-08
    43 27-OCT-08
    44 03-NOV-08
    45 10-NOV-08
    46 17-NOV-08
    47 24-NOV-08
    48 01-DEC-08
    49 08-DEC-08
    50 15-DEC-08
    51 22-DEC-08
    52 29-DEC-08
    53 31-DEC-08
    53 rows selected.
    test@ORA10G>
    test@ORA10G>pratz

  • Week Ending Date Calculation

    Hi -
    I need to calculate weekending in OBIEE Answers.
    The week will start with Sunday and end with Saturday. The week ending date for this week should be Friday of this week.
    for example :
    7th October 2012 (Sunday) - 13th October 2012(Saturday) Week Ending date should be (12th October 2012)
    Thanks!

    user8021111 wrote:
    Hi -
    Sorry.. this doesn't solved my issue..
    for example in column A I have dates like
    Column A Column B(Should be populate the week Ending Date)
    30 SEP 2012 05 OCT 2012
    01 OCT 2012 05 OCT 2012
    02 OCT 2012 05 OCT 2012
    03 OCT 2012 05 OCT 2012
    04 OCT 2012 05 OCT 2012
    05 OCT 2012 05 OCT 2012
    06 OCT 2012 05 OCT 2012
    07 OCT 2012 12 OCT 2012
    08OCT2012 12 OCT 2012
    09 OCT 2012 12 OCT 2012
    10 OCT 2012 12 OCT 2012
    11 OCT 2012 12 OCT 2012
    12 OCT 2012 12 OCT 2012
    13 OCT 2012 12 OCT 2012
    The week ending date should be considered as friday of the week..the week will start from sat and end with sund.. this all should fall under friday of that week..
    Sorry for the inconvenience caused... Thanks again.
    Thanks,Next time give the examples the first time, it'll be easier to see. Here is the formula for column B:
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(column_A)*-1+6, column_A)

  • PDF form Week ending date auto populate

    i have a pdf form i am doing. it has a java script to make the week ending date populate other fields and minus a day.
    if (WEEK_ENDING.rawValue == null)
    {$.rawValue = "";}
    else
    {Num2Date(Date2Num(WEEK_ENDING.formattedValue, DateFmt(1)) - 0, DateFmt(1));}
    endif
    this works for the first date, but when i change it to
    if (WEEK_ENDING.rawValue == null)
    {$.rawValue = "";}
    else
    {Num2Date(Date2Num(WEEK_ENDING.formattedValue, DateFmt(1)) - 1, DateFmt(1));}
    endif
    it does not work. any idea what i am doing wrong?
    Tina

    Hi Tina,
    Well at first look, seems like you mixed FormCalc and JavaScript together...
    Num2Date and Date2Num can only be used in FormCalc, and you can't use these { } in FormCalc
    You should be using the if (), then, else, elseif, endif for FormCalc
    if (WEEK_ENDING.rawValue == null) then
         $.rawValue = ""
    else
         Num2Date(Date2Num(WEEK_ENDING.formattedValue, DateFmt(1)) - 1, DateFmt(1))
         or
         Num2Date(Date2Num(DateTimeField1.rawValue, "YYYY-MM-DD") + 1, DateFmt(1))
    endif

  • Week end Date Query...

    Hi
    I want Week end date for the following Condition.
    1.If month start date from sunday or monday mean week end should be Current Sat date other wise i want next saturday as first week end date.
    For Eg.. AUG 2006
    O/P should be
    12-aug-2006
    19-aug-2006
    26-aug-2006
    31-aug-2006
    2.If Months Starts from sun or monday mean i don't want last sat in the list
    For Eg.. JAN 2006
    07-jan-2006
    14-jan-2006
    21-jan-2006
    31-jan-2006
    Hlp me
    Regards
    Manikandan

    Hi jeneesh,
    Thanks for giving the query ... For the Below Same query i need
    1.If the first week of the month is Sunday Or Monday then week1 ends on the first saturday else week1 ends on the second saturday of the month.
    2. Week 2 ends on the next Saturday ( next to the one identified above)
    3. Week3 ends on the next Saturday ( next to the one indentified in step 2)
    4. Week4 ends on the last day of the Month.
    For Eg of JAN-2006, i don't want to display last sat.. insteed of i want to display last day of the month ,
    SELECT NEXT_DAY(TO_DATE('JAN-2006','mon-yyyy')+5+(N-1)*7,'SATURDAY') col1
    FROM (SELECT ROWNUM N
    FROM DUAL
    CONNECT BY LEVEL <= 4)
    WHERE NEXT_DAY(TO_DATE('JAN-2006','mon-yyyy')+5+(N-1)*7,'SATURDAY') <= LAST_DAY(TO_DATE('JAN-2006','mon-yyyy'))

  • Week ending date after 365 days in sql

    Hi Experts,
    I need to find the week ending date after 365 days of the given week start date .
    Example : Week start date : 23-Jan -2011 (Sunday)
    Desired week end date : 28-Jan-2012 (Saturday)
    How to achive this through sql ?
    Thanks .

    Hi,
    Check below this may help you, adjust "(t.day_num+1)" as per your requirment.
    with t as
    (select decode(to_char(trunc(sysdate + 365), 'dy'),'mon',1,
                                                      'tue',2,
                                                      'wed',3,
                                                      'thu',4,
                                                      'fri',5,
                                                      'sat',6,
                                                      'sun',7) day_num
                                                      from dual
    select to_char(trunc(sysdate + 365)+ (7-(t.day_num+1)),'dd dy-mm-yyyy')   
                                                      from t ;

  • Get the data  from excel and insert into the database

    I want to read the data from excel file, get the data from excel and insert into the database.

    You can use the Apache POI HSSF API to read data from Excel files and you can use the Sun JDBC API to insert data in database.
    This has nothing to do with JSP/JSTL.

  • Hi there - I have an iPhone 4s which I bought from the apple store here in the UK. I am going to South Africa at the end of the year and I want to use a SA sim card - do I need it unlocked?

    Hi there - I have an iPhone 4s which I bought from the apple store here in the UK. I am going to South Africa at the end of the year and I want to use a SA sim card - do I need it unlocked?

    Hi,
    As far as I know, all the iPhones bought online or in the Apple Store ar unlocked.
    Only carriers (e.g. T-mobile, Vodafone, O2) are able to lock a phone, Apple won't do that (afaik).
    This would mean that you shouldn't need to unlock your iPhone.
    Kind regards,
    Hugo

  • TS1474 I have a new PC - great.  But the old PC has now gone and taken the backup of my iPhone 4S with it.  How do I get all my data from my iPhone to a new copy of iTunes on the new PC?

    I have a new PC - great.  But my iTunes library has now gone with the old PC.  With a new iTunes library how do I get all my data from my iPhone to a new copy of iTunes on the new PC?

    It has always been very basic to always maintain a backup copy of your computer.
    Have you failed to do this?

  • Problem in setting user end date from oim to account expiry date in AD process form

    Hi all,
    i am updating the user end date from oim to user account expiry date in ad process form using oim api.
    i am able to get the end date value from oim but when i am setting it using api it through exception but all other attribute i am able to update in process form.
    i am facing the problem only with end date field because of different date format in OIM and  AD .
    so please suggest me what are date format in Active Directory and how can i change the oim date format to Active directory time format in in my java code.

    Thanks for the reply.
    But all iplanet users need not contain end date attribute, and its an update on existing user.
    Can you please ellaborate more on Transformation class..?? example should be helpful.

Maybe you are looking for

  • How do i delte more than one image at a time from all images folder on iMac

    i have 7000 images in the my images folder, how can I delte them all at once?

  • HeapSpace Error in JPA

    Hi, Exception : Out of Memory Error: Java Heap Space This is exception is occured when retrieving large amount of records from database through JPA.. How to solve this issue. Regards Sucharitha.

  • Problems of no multiple inheritance.

    I have created two classes RECTANGLE with attributes Length and Height and PLANERECTANGLE, with various attributes required to specify the rectangle's center, an attribute that can be checked to see if it is inside an instance of rectangele. However,

  • Authorization issue in SAPJRAFactory

    Experts I am using the JRA factory inside the webservice to retrieve the information from the BAPI. The application is working fine in the Development environment, after transporting the same ear file to Acceptance, I got the following error. Error:

  • JTextArea need help in size

    Hello everyone. I have a quick question. When my program opens I have the window open to the max by getting the screen size dimension. I also have a text area in the frame that I would like do to the same. Any ideas? I have tried setRow, setCol but t