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

Similar Messages

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

  • Get Months for the given date ranges on the Selection Screen

    Hello All,
    If I give Begin Date (Begda) and End Date (Endda) on the Selection Screen, I need to get all the months given in the selection screen ranges.
    Could any one please suggest me how to proceed further on this.
    Thanks in Advance
    Regards
    Yathish

    HI,
    Check this FM
    HR_99S_INTERVAL_BETWEEN_DATES  ---> this can help you it will return the month in this table MONTH_TAB
    HR_99S_MONTHS_BETWEEN_DATES

  • Calculate Avg  for the given months based on the no. of days in months

    Dear Experts
    I  have a report in which there is a characterictic claenderyr/month.The Input paramter is claenderyr/month which is restricted by a variable of type interval. i mean user will enter calenderyr/month as interval say 012010 to 06.2010. Now I have to calculate Avg sale Qty for the given months based on the no. of days for the given range of months. How I can achieve this in BW Query. Pl. advice
    Dinesh Sharma

    Hi,
    Create formula for the sales qty.
    maintain the exception aggregation as average based on calday
    Best Regards,
    M.H.REDDY

  • Day wise Closing stocks for the given month

    Hi,
    Please suggest me your valuable ideas for Closing Stocks Calender day wise for the given month.
    Ex : User Input 03.2013 , now report has to show daywise closing stock like below
                                            01.03.2013    140 MT
                                             02.03.2013     150 MT
                                              31.03.2013    230 MT.

    I like recursive with clause B-)
    with rec(StaV) as(
    select extract(day from date '2011-01-01')
      from dual
    union all
    select StaV+1
      from rec
    where StaV+1 <= extract(day from last_day(date '2011-01-01')))
    select ListAgg('''' || to_char(StaV) || '''',' ')
           within group(order by StaV) as days
    from rec;
    DAYS
    '1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' '29' '30' '31'

  • Find 3rd friday of the month for a given date

    how to find out 3rd friday of the month for a given date? I can always pass the first day of the month as input
    eg, input date is 01-JAN-09. need to get the 3rd friday 16-JAN-09 (Jan has 5 fridays 02, 09, 16,23,30)
    input date : 01-feb-09, need to get 20-feb-09
    Edited by: user520824 on Apr 1, 2009 12:30 PM

    NLS independent solution:
    SELECT  DT,
            TO_CHAR(DT,'FMDay') day,
            CASE
              WHEN TRUNC(TRUNC(DT,'MM') + 7,'IW') - 3 < TRUNC(DT,'MM') THEN TRUNC(TRUNC(DT,'MM') + 7,'IW') + 18
              ELSE TRUNC(TRUNC(DT,'MM') + 7,'IW') + 11
            END THIRD_FRIDAY_OF_THE_MONTH
      FROM  (
             SELECT  TO_DATE(LEVEL || '/2009','MM/YYYY') DT
               FROM  DUAL
               CONNECT BY LEVEL < 13
    DT        DAY       THIRD_FRI
    01-JAN-09 Thursday  16-JAN-09
    01-FEB-09 Sunday    20-FEB-09
    01-MAR-09 Sunday    20-MAR-09
    01-APR-09 Wednesday 17-APR-09
    01-MAY-09 Friday    15-MAY-09
    01-JUN-09 Monday    19-JUN-09
    01-JUL-09 Wednesday 17-JUL-09
    01-AUG-09 Saturday  21-AUG-09
    01-SEP-09 Tuesday   18-SEP-09
    01-OCT-09 Thursday  16-OCT-09
    01-NOV-09 Sunday    20-NOV-09
    DT        DAY       THIRD_FRI
    01-DEC-09 Tuesday   18-DEC-09
    12 rows selected.
    SQL> SY.

  • Any FM to get count of each week day for the given date range

    Hi guys,
    Any FM to get count of each week day for the given date range?
    eg: If i give 14/07/2008 to 14/08/2008
    I need to find how many Mondays, tuesdays...sundays in this given date range.
    If not single FM is available, any logic that gives above result is also appreciated.
    Thanks,
    Vinod.

    hi Vinod,
    this is not a full solution, I just give you a basic idea:
    DATA : lv_start TYPE sy-datum VALUE '20080714',
           lv_end   TYPE sy-datum VALUE '20080814'.
    WHILE lv_start LE lv_end.
      CALL FUNCTION 'FTR_DAY_GET_TEXT'
        EXPORTING
          pi_date = lv_start.
    * IMPORTING
    *   PE_DAY_TEXT1       =
    *   PE_DAY_TEXT2       =
    *   PE_DAY             =
    * you have to summarize the output here somehow...
      lv_start = lv_start + 1.
    ENDWHILE.
    hope this helps
    ec

  • Repeating Events for the Fifth Week of the Month

    Hello,
    I am attempting to create a calendar schedule to distribute to members of my club. Each member is responsible for a certain day of the month (eg, every first monday).
    iCal gives me the option to select every First, Second, Third, Fourth, or Last weekday of the month for repeating events. Did Apple forget that some months have five weeks in them, or am I really going to have to schedule events for the fifth week manually?
    Thanks,
    -Noel
    Mac Mini   Mac OS X (10.4.8)  

    Hi Noel,
    Welcome to Apple Discussions.
    iCal does not have this feature.
    I tried playing around by scripting the addition of events with the correct rfc2445 recurrence string, but in iCal the events were placed in the first week of the following month on months with four weeks.
    If you want this feature in the future, ask Apple for it.
    Best wishes
    John M

  • FM that gives number of day in the week for the given date

    Hi,
    I have a requirement to find the number of the day in a week for the given date. For example, 07/09/2009 is Thursday & 4th day of the week. Is there any FM to accomplish this task?
    Appreciate your help in Advance.
    Thanks,
    Kannan.

    Hi Kannan,
    ISH_GET_DAY_OF_WEEK.
    Regards,
    Dilek

  • Up data for the next week or just let it go over?

    Everyone on my plan except my poor son has unlimited data - he became old enough to have a phone too late.  He is going out of town on a school trip on Thursday and is thisclose to bumping up against his data limit (which happens every month).  Normally I wouldn't do anything, but I do want him to be able to use his phone/data on the trip.  I can't find an easy way to up his data online.  Not being on hold for 30 minutes for customer service is worth something to me as well.  Should I up his data amount or just let him run over a GB?  Are we talking either $10 (to up his data plan) or $15 (to go over his data)?  I'll pay an extra $5 not to have to call them.  And then have to call them back when our new billing cycle starts in a week - LOL.

    My son has had a phone for 2+ years now, so he is well versed in using wifi when it is available.  However, we live in a rural area and wifi options are not plentiful.  His biggest drain, I think, is that he won't use his high school's wifi because he says it's crap.  Not sure I believe that, but he understands the consequences (running out of data before the end of our billing cycle) and normally lives with them without complaining.  In this one case, I want him to have data even though he's used his allotment up for the month.  We are on a nationwide plan and our billing month ends on the 6th.
    If what mrniceguy says is accurate, my choices are to call them and pay $20 and have to call them back to lower it again, or do nothing and pay $10.  In that case, I choose to do nothing and spend less money. :-)
    I have usage controls set for him, so I went in and bumped up his limit usage to close to 3 GB and will go back in May 7 or soon after and put it back to where it is normally.
    Our family must be data hogs.  I don't use a lot of data because we have home wifi and I also connect to my employer's wifi; my husband's job does not have wifi so he's a pretty big user; and my daughter, who is in college but lives off campus, routinely uses ~12 GB of data every month.
    We will stay on this plan as long as possible, and know that if we want new phones, we will have to pay full price.  We also have all the phones fully insured so that if something happens to one of our phones, we don't have to drop $500+ until we are ready to. I am going to look into moving my son to Straight Talk so that he can have unlimited data too, and if he doesn't see any negative changes, we will all switch.  No reason to pay so much more every month for the same product.
    Thanks for the replies!

  • Why is basic visual voice mail free on the Note 3 and 2.99 a month for the S4 ?

    Why is basic visual voice mail free on the Note 3 and 2.99 a month for the S4 ?

    I'm trying to reach these issues myself. There are a few different flavors of voicemail:
    Basic voice mail -- the kind you call in with your phone and press touch tones, like people used to do twenty years ago. Included with contract.
    Basic visual voice mail -- see your messages listed by caller, choose which one to play. Included with contract, but only on certain phones. The Note yes, Galaxy s5 yes, Galaxy s4 no.
    Visual Voice Mail -- the 2.99/mo version Verizon wants you to pay for. Has the features of 2, but also will transcribe your voice mails into text. Available on most phones because it is a Verizon app.
    iphone visual voicemail. Same as 2, for all intents and purposes. Has always been included because Apple established it as a condition for the carriers to be permitted to sell them.
    The mystery is number 2, what you are asking about. Though it is mentioned on a verizon comparison chart, 'basic visual voicemail' is not discussed in any verizon literature and I suspect most techs don't know about it yet. It seems to have been enabled with a kitkat update (version 4.4.4 of Android) that has been released on some, but not all phones. I think the way it worked is that users were given a free trial of the pay version of voicemail, but at the end of the trial were able to 'downgrade' to basic voicemail and keep that without paying.
    I also have an S4, and basic /no cost visual voice mail does not seem to be possible, though I have heard there may be some ways to make it work with technical workarounds. I have not confirmed any of these methods but they almost certainly would not be recommended by Verizon staff.
    To get back to your question, basic visual voicemail and what Verizon calls regular 'visual voicemail' are different products. The basic seems to be a recent product only available on some phones. The regular 'visual voicemail' is the pay service available on all phones.

  • RE: calculate no of months for the calmonth variable range enetered

    Dear All,
    Please can anyone tell me for a given  calmonth range entered in the selection screen how do i get the no of months for the range entered.
    I need to use this figure in calculating the no of stock turn overdays.
    for ex: 01.2009 to 03.2009---no of months = 3
    03.2009 to 08.2009 ---no of months = 6
    So depending on the values entered for calmonth variable(as a range) how do i get the no of months in the report.
    Please advice
    Regards
    Madhuri

    create new formula varaible and processing type customer exit and put this below code in cmod.
    Say formula varaible is ZFNODAYS and 0calmonth variable is ZCALMONTH.
    IF I_STEP = 2.
    data: yrd(2),
            mmd(2).
    Read table it_var_range into wa_it_var_range where vnam = 'zcalmonth'.
    yrd = wa_it_var_range-high+3(4) - wa_it_var_range-low+3(4).
    yrd = yrd * 12.
    mmd = wa_it_var_range-high(3) - wa_it_var_range-low(3).
    mmd = mmd + yrd.
    if i_vnam = 'ZFNODAYS'.
    l_s_range-low = mmd.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    append l_s_range into e_t_range.
    clear l_s_range.
    endif.
    ENDIF.

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

  • 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

  • Err "Couldn't retrieve binding for the given channelId" in receiver SOAP CC

    Hello.
    We have increase the support package level of our XI 3.0 system from level 17 to 23. After this "upgrade" all interfaces using a receiver SOAP channel communication are getting the next error:
    SOAP: response message contains an error XIServer/UNKNOWN/ADAPTER.JAVA_EXCEPTION - com.sap.aii.af.service.cpa.impl.exception.CPALookupException: Couldnt retrieve binding for the given channelId: Binding:CID=8cb6335a548730ea9ca27aaa78034109; at com.sap.aii.af.service.cpa.impl.lookup.AbstractLookupManager.getBindingByChannelId(AbstractLookupManager.java:361) at com.sap.aii.af.mp.soap.web.MessageServlet.doPost(MessageServlet.java:421) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401) at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266) at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386) at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364) at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039) at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265) at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95) at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    We have done the next steps:
    - Run SXI_CACHE and start a complete cache refresh,
    - http://<Host>:<portNo.>/CPACache/refresh?mode=full
    - Restart J2EE server.
    The problem isn't solved.
    any idea?

    Probably you need to ask your BASIS team if they have done it or not.
    Secondly you can just see if something has been done under SWCV SAP BASIS --- http://sap.com/xi/XI/System --- Adapter Metadata, just by oping any adapter and then by looking at Properties or Hisotry from menu "Adapter Metadata". Here you can see the date under "Changed on", so if this matches with your upgrade date then something has been done. But this check will not help you know about the SP level. So better to ask with BASIS.

Maybe you are looking for

  • Error while Updating document details using Edit option

    We are currently on Oracle Application Server 10g (9.0.4) on Solaris, 64 bit. We have added new perspectives on the knowledge portal which we use within our firm. We are able to upload documents with new perspectives but when we try to edit currently

  • Eraser tool in Photoshop CS5 (block mode)

    Hello, experts: Several months ago, I noticed that, when using the Photoshop CS5 eraser tool in block mode,  it was not working right up to the edges of the tool (the block icon that apperars on screen). In other words, when erasing, I have to guess

  • Preview issue with software recording in Captivate

    i have a software recording w/ intro slides - it look fine in the filmstrip view but after the intro slides (once in software recording) it cuts off a significant portion of the screen from view. I recorded the application window and it was a web bas

  • DW/CS3 Preview in browser puts the file, not previews it.

    DW/CS3 When I preview in browser DW puts the file to the ftp remote server. It will not preview the local file in my primary or secondary browser. It was ok in Win XP but I now have Win7 64.

  • Error PLS-00103 when trying to create a trigger

    Hello folks, I am trying to create a trigger but I am encountering this error telling me that Oracle expected a ";" but found a bracket "(" in line 7. I have not yet found out what's the problem. It would be very appreciated if somebody could give a