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

Similar Messages

  • 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 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..

  • 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.

  • 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);

  • 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

  • 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

  • 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

  • How to get XLR to show BPs with no transaction data for a given date range

    Hi -
    I am building an XLR report that does a comparison of net sales data across two periods for a given sales employee's BPs.
    The report has the row expansion:
    FACT BPA(*) SLP(SlpName = "ASalesPersonNameHere") ARDT(Code = "ARCreditMemo", "Invoice") Group by BPA.CardName
    and column expansions:
    FIG(SO_TaxDate = @StartDate:@EndDate)
    and
    FIG(SO_TaxDate = @StartDate2:@EndDate2)
    where @StartDate, @EndDate, @StartDate2, @EndDate2 are parameters that define the two ranges of dates.
    The column formulas are, from left to right:
    =ixDimGet("BPA", "CardName")
    =ixGet("SO_DocTotal")      <-- filtered by column expansion for first date range
    =ixGet("SO_DocTotal")      <-- filtered by column expansion for second date range
    The report works fine except for one problem, I would like it to include BPs for which no transaction occurred in either date range as well.
    Any help is greatly appreciated!
    Thanks,
    Lang Riley

    Really appreciate your feedback!  Those are good suggestions. I should have mentioned that I had already tried both those suggestions.
    Removing FACT on BPA in this case ends up returning all the BPs and not respecting the SLP(SlpName = "aName") part of the query. 
    Using **, i.e., * or #NULL, makes no change in the resulting data in this case.  I had thought that ** would be the solution, but it didn't change the outcome.  I still have BPs for which when their sales employee is used as the filter and they have no transactions for either date range, and yet they still do not appear. 
    I should further mention that the IXL query, as it now stands, does return BPs for which one of the periods has no data, just not both, and I have verified that applicable BPs with no transaction data for both periods do exist in my data set.  It seems that perhaps the IXL query needs to be restructured?  Please keep the suggestions coming including how this query might be restructured if necessary.

  • How to Calculate End-Date for a given Startdate in business hours without holidays

    Hello Experts,
    I need to create a plsql function where we need to determine end date for a task. For this, input will be only start date & number of hours allocated for that task. Based on this input we need to exclude Business hours & need to include only Business hours. and in the end we need to achieve the end date after the hour addition to the start date.
    Example : INPUT: 03-OCT-2013 12:00:00 PM /
                                  Hours Allocated 30 Hrs.
    Business Hours - 11 AM to 9 PM.
    So time starts from or Startdate is Friday 03-OCT-2013 12:00:00 PM. 
    So If I want to calculate the end-date by adding 30 hours to it, it should come WednesDay 09-OCT-2013 12:00:00 PM because I excluded Weekends & considered only business hours that is 11 am to 9 pm.
    I am not able to get any such guidance in Internet as most of the docs are having start & end date as input.
    Please help!
    Thanks in advance !!

    Hi,
    As Christ said, there's no nuilt-in Oracle function to tell whether a given DATE is a holiday or not, partially because there's so much local variation in holidays.  You can write a function like that (see http://forums.oracle.com/forums/message.jspa?messageID=3351081 ), but creating a table will be simpler and more efficient.
    I suggest creating a row for every date, whether it's a work day or not; that way, you can have variations in the schedule (e.g., schedule changes and
    partial holidays).
    CREATE TABLE  work_calendar
    (   dt  DATE       PRIMARY KEY
                       CONSTRAINT  work_calendar_dt
                           CHECK (dt = TRUNC (dt))
    ,   day_type       VARCHAR2 (8)  NOT NULL
                       CONSTRAINT  work_calendar_day_type
                           CHECK ( day_type IN ( 'HOLIDAY'
                                               , 'WEEKEND'
                                               , 'WORK DAY'
    ,   start_time     DATE
    ,   end_time       DATE
    ,   work_hours     NUMBER
    ,   work_hours_since_1970     -- or some point earlier than you'll ever need
                       NUMBER
    ,   CONSTRAINT  work_calendar_start_time
            CHECK ( TRUNC (start_time) = dt)
    ,   CONSTRAINT  work_calendar_end_time
            CHECK ( TRUNC (end_time) = dt)
    This will let you do a lot of the calculations you need without a function.

  • Problem in retreiving data for the given user parameter year!!!

    hi all,
    I am working in oracle report 6i. I want to display the data for the date given in the parameter field(MM/YYYY).
    For ex. Input is 07/2007 means i want to display the data from 04/2006 to 07/2007.Please guide me
    to get this desire output......
    Here is my query.....
    select gl_code,financial_month,financial_year,division_code
    from gtemp
    where financial_year between to_number(to_char(:P_Date,'YYYY')) - 1 and to_number(to_char(:P_Date,'YYYY'))
    and financial_month >= '04'
    and financial_month < = to_char(:P_Date,'MM')
    and division_code = 11
    order by financial_month, financial_year
    regards,
    jame
    Message was edited by:
    Jame

    Works fine if u gave values instead of variables.... But if we gave 02 in place of 11 like below.Query will get
    confused to take which years 02 because in both 2005 and 2006 we have 02(Feb)thats y.......
    how to overcome this prob.......I think, my entire query is wrong to get this desire output....Please guide me how
    to solve......
    select gl_code,financial_month,financial_year,division_code
    from gtemp
    where financial_year between 2005 and 2006
    and financial_month >= '04'
    and financial_month < = '02'
    and division_code = 11
    order by financial_month, financial_year

  • 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.

  • How can I set an validity date for a given vendor?

    Hello,
    we are currently trying to set a "validity date" for vendors.
    Basically, our vendors need to be audited, and are "accepted" for a period of time, beyond which we'd need to re-audit them.
    What we'd like the system to do is block use of the vendor if this date was exceeded.
    Anyone has an idea on the way to achieve this?
    PS: We know that there is a way to do this at the material level, we instead wish to manage it centrally for the vendor
    Tx

    Hello Nisha,
    before doing business with a new vendor for services, our QA group needs to go thru a serie of verifications. We check various things such as insurance, certification,...
    Once "approved", the vendor can be utilised by the plant for a certain period of time, after which a "re-audit" is necessary.
    What I'd like to implement is a field where the QA group would enter this date, after which the vendor would be automatically blocked for usage.
    This would then trigger the "re-audit" followed by the release from QA (who'd re-modify the date with the new one), and so on.
    The vendor is not necessarily used for supply chain. Sometimes, it could be for services , maintenance, or other.
    Tx for the ideas.

  • The endless message telling me that I've turned off cellular data for a given app is driving me crazy

    Like many of you I don't have an unlimited data plan anymore. So I've chosen to turn off the ability for some things to download anything unless it's on WiFi. In spite of this the d@#ned phone keeps telling me that I need to turn on cellular dat for "pick the app". I'd wish the phone would shut up and just work. Wait a mnute! Wasn't that one of the original slogans Apple had?

    Did you get anywhere with this? I'm considering wiping it and setting it up as a new device.

  • Function module to predict the date for a given date

    hi friends,
    is there any function module to predict the date
    means  for example if i enter one date  , what will be the date
    after 4 months(say)  to the given date.
    my requirement is when a person is hired today (10.06.2008)
    and if he is under probationary for 6 months, then on what date he comes into the permenant employee's list(predicted date after date 6 months)

    Date calculations
    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_IN_FUTURE Calculate a date N days in the future.
    RP_CALC_DATE_IN_INTERVAL Add days/months to a date
    RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
    SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
    MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
    DATE_CREATE Calculates a date from the input parameters:
    Example: DATE_CREATE
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
       anzahl_jahre  = 1
       anzahl_monate = 2
       anzahl_tage   = 3
       datum_ein     = '20010101'
    IMPORTING
       datum_aus     = l_new_date.
       Result:
       l_new_date = 20020304
    Example: MONTH_PLUS_DETERMINE
    data: new_date type d.
    CALL FUNCTION 'MONTH_PLUS_DETERMINE'
    EXPORTING
    months = -5 " Negative to subtract from old date, positive to add
    olddate = sy-datum
    IMPORTING
    NEWDATE = new_date.
    write: / new_date.

Maybe you are looking for