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)

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.

  • Getting the Last day for a given week number

    Dear Gurus,
    I want to find the Last day of a given week number.
    Can anyone help me out.
    Regards
    Madhu K

    Here I dont want to pass date,
    If I give Week Number, Can I get that Week Numbers
    Last date and First Date.
    test@ORA10G>
    test@ORA10G> -- this query fetches the start and end dates for a specified week in the current year
    test@ORA10G>
    test@ORA10G> select
      2    wk as week,
      3    min(dt) as start_date,
      4    max(dt) as end_date
      5  from (
      6    select
      7      trunc(sysdate,'yyyy')+level-1 as dt,
      8      to_char(trunc(sysdate,'yyyy')+level-1,'ww') as wk
      9    from dual
    10    connect by level <= trunc(add_months(sysdate,12),'yyyy') - trunc(sysdate,'yyyy')
    11  )
    12  where wk = &week_number
    13  group by wk;
    Enter value for week_number: 1
    WE START_DAT END_DATE
    01 01-JAN-08 07-JAN-08
    test@ORA10G>
    test@ORA10G> /
    Enter value for week_number: 23
    WE START_DAT END_DATE
    23 03-JUN-08 09-JUN-08
    test@ORA10G>
    test@ORA10G> /
    Enter value for week_number: 52
    WE START_DAT END_DATE
    52 23-DEC-08 29-DEC-08
    test@ORA10G>
    test@ORA10G> /
    Enter value for week_number: 53
    WE START_DAT END_DATE
    53 30-DEC-08 31-DEC-08
    test@ORA10G>
    test@ORA10G>pratz
    can be shortened further:
    test@ORA10G>
    test@ORA10G> select
      2    to_char(trunc(sysdate,'yyyy')+level-1,'ww') as wk,
      3    min(trunc(sysdate,'yyyy')+level-1) as start_dt,
      4    max(trunc(sysdate,'yyyy')+level-1) as end_dt
      5  from dual
      6  where to_number(to_char(trunc(sysdate,'yyyy')+level-1,'ww')) = &week_number
      7  connect by level <= trunc(add_months(sysdate,12),'yyyy') - trunc(sysdate,'yyyy')
      8  group by to_char(trunc(sysdate,'yyyy')+level-1,'ww')
      9  /
    Enter value for week_number: 1
    WK START_DT  END_DT
    01 01-JAN-08 07-JAN-08
    test@ORA10G>
    test@ORA10G> /
    Enter value for week_number: 53
    WK START_DT  END_DT
    53 30-DEC-08 31-DEC-08
    test@ORA10G>
    test@ORA10G> /
    Enter value for week_number: 23
    WK START_DT  END_DT
    23 03-JUN-08 09-JUN-08
    test@ORA10G>
    test@ORA10G> /
    Enter value for week_number: 14
    WK START_DT  END_DT
    14 01-APR-08 07-APR-08
    test@ORA10G>
    test@ORA10G>Message was edited by:
    pratz

  • BAPI to fetch Delivery Data for  a given delivery number

    Hi Experts,
    Is there any SAP Standard BAPI to Fetch the Delivery/Picking data.
    Just to fetch  all the Delivery/Picking related data from SAP on Providing a Delivery Doc number.
    I will be thankful to you , if u let me know how to connect VB application to SAP using BAPI to fetch the data to VB application.
    Thanks & regards,
    Prashanth

    Go thru these links
    [link1|http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/content.htm]
    [link2|http://searchsap.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid21_cid417095,00.html]
    [link3|http://www.experts-exchange.com/Database/Software/ERP/SAP_ERP/Q_20693539.html]
    Regards,
    SAPient

  • How to get the date of Friday for the given week

    HI,
    I have a requirement to get the date of Friday for the given week.
    Eg: I have an input of 200722 (Yearweek), From this I need to get the Date of the friday for this week 22 of Year 2007.
    Plz let me know how to get this..
    Thanks in advance..
    Sridhar.

    Hi,
    Thanks for your reply...
    I have implemented your logic but not getting exact output as required.
    Suppose, If i give the input as 200720, I am getting an output as 18 (friday of week 20 of year 2007), but i need to get an output of 18.05.2007
    Plz let me know how to do thdi.
    Thanks in advance..

  • Month for the given Week

    Can anybody tell me how to get the month for the given week..
    In my requirement I have week(201026).
    For this input, i nedd the month for this 26th week .
    Thanks in Advance.
    Moderator Message: Basic Date-related questions are not allowed since they are FAQ.
    Edited by: kishan P on Dec 17, 2010 1:17 PM

    Here's that code modified to something much more like what you specified. It prints the number of weeks between to dates inclusive, eg. there are 4 weeks between "Feb 1, 2003" and "Feb 28, 2003" not 3.something.
    I am now using the number of milliseconds in a day instead of in a week. The value 86400 is 24*60*60.
    I've also changed the input format to support days like
    June 1, 2003. Note you will need to put the args in "" when you run it because of the spaces.
    import java.util.Date;
    import java.text.*;
    public class TestTP
         static double MILLIS_PER_DAY = 86400*1000;
         public static void main( String args[ ] ) {
              double weeks;
              Date d0,d1;
              for (int i = 0; i<(args.length-1); i+=2)
                   d0 = parseDate(args);
                   if(null == d0)System.out.println(args[i]+" is bad");
                   else
                        d1 = parseDate(args[i+1]);
                        if(null == d1)System.out.println(args[i+1]+" is bad");
                        else
                             double days = dayDiff(d0,d1); // get difference in days
                             weeks = (1+days)/7;               // make it inclsive in weeks
                             System.out.println(args[i+1]+" is "+weeks+" weeks after "+args[i]+" inclusive");
         static Date parseDate(String ds)
              Date dt;
              SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy");
              sdf.setLenient(false);
              try{dt = sdf.parse(ds);}
              catch (ParseException e){dt = null;}
              return dt;
         static double dayDiff(Date d0, Date d1)
              return (d1.getTime()-d0.getTime())/(MILLIS_PER_DAY);

  • FM for get the week number

    Hi experts..
    I need a FM for get the week number...
    for example today 14 april 2010 is the  15 week from the start of the year..
    best regards
    Marco

    Hi,
    Check this Fm : GET_WEEK_INFO_BASED_ON_DATE .
    Just enter the date
    the week parameter returns the year and week number. the last 2 digits give the week number.
    Thanks.

  • How do i get the date when enter a week number

    Hi, can anyone tell me how do i get the date when enter a week number??
    let say, i enter week number 4 and year 2008
    result=26-01-2008
    thanks..

    import java.util.Calendar;
    public class testCalendar {
         public static void main(String args[]){              
              int year=2008;
              int week =5;
              Calendar now=Calendar.getInstance();
              now.set(Calendar.YEAR,year);
    now.set(Calendar.WEEK_OF_YEAR,week);
              System.out.println(now.getTime());          
    hai, anyone know why i can't get the result:27-01-2008
    i always get two day later. That is 29-01-2008
    no wonder how i change the week number and year.
    for example: week=7, year=2007
    expected result:11-02-2007
    but the result is 13-02-2007
    thanks..
    Edited by: Angel_Wei on Sep 1, 2008 11:58 PM

  • How to find Assembly Numbers for a given Equipment Number

    Hi all,
    Can anyone pls help me out in finding the assembly numbers for a given equipment number??
    Thkz in advance.
    Harpreet.

    Hi
    Try a code like this:
    DATA: BEGIN OF MCHA_KEY,
           MATNR TYPE MATNR,
           WERKS TYPE WERKS_D,
           CHARG TYPE CHARG_D,
          END   OF MCHA_KEY.
    DATA: BATCHCLASS LIKE BAPI_CLASS_KEY-CLASSTYPE VALUE '022'.
    DATA: OBJECT_CLASSIFICATION LIKE  BAPI_OBJECT_VALUES
                                                  OCCURS 0 WITH HEADER LINE,
          CLASS_OBJECTS LIKE  BAPI_CLASS_OBJECTS  OCCURS 0 WITH HEADER LINE.
    DATA: _CLASSNUM LIKE BAPI_CLASS_KEY-CLASSNUM.
        BAPIFLAG = 'X'.
        CALL FUNCTION 'BAPI_CLASS_GET_CLASSIFICATIONS'
             EXPORTING
                  CLASSTYPE              = '022'
                  CLASSNUM               = _CLASSNUM
                  CHARACTS_OF_CLASS_ONLY = BAPIFLAG
             TABLES
                  OBJECT_CLASSIFICATION  = OBJECT_CLASSIFICATION
                  CLASS_OBJECTS          = CLASS_OBJECTS
             EXCEPTIONS
                  OTHERS                 = 1.
    Max

  • Need a function to calculate employee attendance data for a given period

    need a function to calculate employee attendance data for a given period
    as
    Working days,
    CL ,
    SL,
    PL,
    LWP
    regards,
    Gaurav Sood.

    Issue resolved

  • Query returns data from previous month. Need to have it return data for the entire year

    This is the part of the query that returns data by month:
    (YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)AND MONTH(`rereport`.`market_reports_5`.start_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH))
    How can I get it to return data for the year.
    TIY

    How about omitting the MONTH part:
    (YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • 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

  • Any BAPI to retreive sales area for the given BP Number in CRM

    HI, I am looking for a BAPI which can retreive sales area for the given BP number.
    I appreciate for the quick response and points are awarded.
    Thanks,
    Kumar.
    Edited by: Kumar on Jun 5, 2008 6:40 PM

    Hi Kumar,
    This is not exactly a Bapi but you can use the following 2 functions.
    The function below will get a list of sales areas assigned to the BP.
    call function 'CRM_BUPA_FRG0010_GET_LIST'
        exporting
          iv_partner_guid = lv_partner_guid
        importing
          et_sales_areas  = lt_areas.
    You can then use CRM_BUPA_FRG0030_GET_DETAIL to get the detail of the sales area.
    Hope it helps.
    Johan

  • Any BAPI to retreive salease area for the given BP Number in CRM

    Hi, I am looking for a BAPI to retreive sales area information for the given BP number in CRM.
    I appreicate for quick response and points are awarded.
    Thanks,
    Kumar

    Hi Kumar,
    This is not exactly a Bapi but you can use the following 2 functions.
    The function below will get a list of sales areas assigned to the BP.
    call function 'CRM_BUPA_FRG0010_GET_LIST'
        exporting
          iv_partner_guid = lv_partner_guid
        importing
          et_sales_areas  = lt_areas.
    You can then use CRM_BUPA_FRG0030_GET_DETAIL to get the detail of the sales area.
    Hope it helps.
    Johan

Maybe you are looking for