How to get the week number of year from a Date object?

Hi!
I would like to know the week number of the year from a specified Date.
I dont know how to set the first day of week, and set the minimum days of a week.
I want to use Monday for first day of week, and at least 4 days of month in a week.
For example if its 1st, January is Friday, then the first week starts on 4th, Monday.
Anyone can help?

Sorry. I should think before I move.
     public static int getWeekOfYear(Date date) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.setFirstDayOfWeek(Calendar.MONDAY);
         calendar.setMinimalDaysInFirstWeek(4);
         return calendar.get(Calendar.WEEK_OF_YEAR);
     }

Similar Messages

  • How to get the week number for a given date?

    hi guys,
    what is coding to get the week number for a given date?
    For example, 1/1/05 is week 1. then 8/1/05 is week 2.

    The second parameter to pass to the method is supposed to be one of the month constants JANUARY - DECEMBER. It happens to be that their numerical values are 0-11, not 1-12, so your "12" refers to the "13th" month of the year.
    givenDate = new GregorianCalendar(2003, Calendar.DECEMBER, 31);
    If you want to construct dates and times from strings like you seem to be, look into SimpleDateFormat http://javaalmanac.com/egs/java.text/ParseTime.html
    (even still I got WEEK_OF_YEAR as 1 which is true but not really what I expected, excuse my previous reply but I wanted to check the facts before posting this)

  • How to get the currrent month and year from a new date object

    If I create a new Date object as "d",
    java.util.Date d = new java.util.Date();how can I format the date to get the current Month as 'Jan' and the current year as '2008'. So if I have something like d.getMonth() gets the current month as 'Oct' and d.getYear() gets '2008'
    Thanks,
    Zub

    [Read the flamin' manual you must. Hmm.|http://en.wikipedia.org/wiki/RTFM]
    ~~ Yoda.
    Well no actually, he didn't say that, but he should have.
    Cheers. Keith.
    PS: Don't say that to a 7 foot pissedOff wookie when he's got his head stuck in a smoking hyperdrive, and you're being chased by a S-class battle cruiser... Ask Yoda how he got to be so short.
    PPS: It is the SimpleDateFormat you seek ;-)
    Edited by: corlettk on 14/10/2008 22:37 ~~ Also far to slow... but funny.

  • 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 to get the total number of pages printed in a report?

    Hi All,
    I have a requirement where I need to print a frame of fields only in the last page. Unfortunately I cannot use the 'Print Object On' property as it doesnt work in my case. So, I am planning to write a format trigger on the frame to return TRUE if the page is the last physical page. Now, I need to know how to get the total number of physical pages that will get printed in the report so that I can use this to manipulate the frame. I was planning to use the 'Total Physical Pages' built-in, but it seems like I can just use it to print in a field and I can't use this field's value anywhere in the plsql code (formula column function/format trigger) in the report. Is there anyway to get the total number of pages printed in the report which can be used in the report plsql code?
    Thanks,
    Srini.

    i found the solution, thanks

  • How to get the page number in the break section?

    Hi expert,
    The user wants the page number came right after the Break group name if the break section contains more than 1 page. E.g.
    ABC Compnay
    XXXXXXXXXXX XXXXXXXX
    XXXXXXXXXX XXXXXXXXXXXX
    BCD Company, p 1
    XXXXXXXXXXX XXXXXXXX
    XXXXXXXXXX XXXXXXXXXXXX
    BCD Company, p 2
    XXXXXXXXXXX XXXXXXXX
    XXXXXXXXXX XXXXXXXXXXXX
    CDE Company
    XXXXXXXXXXX XXXXXXXX
    XXXXXXXXXX XXXXXXXXXXXX
    How to get the page number in section break level?

    Hi Wes
    * Create a Field on the margin.
    * Set its "Source" to "Page Number"/"Physical Page Number".
    * Click "Page Numbering" button.
    * In "Reset At" list box, choose the Repeating frame that surrounds your detail group in the layout.
    This should cause Reports to increment the page number until the "Company" repeating frame resets.
    Regards
    Sripathy

  • How to get the Page Number in CS3 with VB?

    Hi, Everybody
    I use the Visual Basic to read the words and their page number where the Words are at. I want to do it according to Story. Some TextFrame of the Story waw placed in other pages: How can I get the Page number according to the Word that is selected?
    For myStoryCounter = 1 to Document.Stories.Count
    Set myStory = Document.Stories.Item(myStoryCounter)
    For myWordCounter = 1 to myStory.Words.Count
    Set myWord = myStory.Words.Item(myWordCounter)
    myWordContents = myWord.Contents
    Rem ** How to Get the Page Number according to the Word ***
    Next
    Next

    > But I don't understand why Item(1) are set.
    because Word can have more than one parent TextFrame - when split across TextFrames
    only Character have one ParentTextFrame accessed also by ParentTextFrames.Item(1)
    > why Story.TextFrames.Count alway is 0, Is it bug?
    no - it's not bug
    in older IDs - Story.TextFrames collection refer to all TextFrames as containers for Story text
    but in CS3 - collection Story.TextFrames contain all TextFrames inserted as InLine/Anchored objects - same like Story.Rectangles or Story.Ovals
    in CS3 - when you want to refer to TextFrames as containers for Story text - you need to use Story.TextContainers - because now you can link TextFrame and Text-On-Path as Story - Text-On-Path isn't TextFrame
    robin
    www.adobescripts.com

  • How to get the document number for a ware house order.

    Hello gurus,
    how to get the document number for a ware house order. [if GI is posted refering that WH order] .. is there any report?
    Thanks in advance

    There are several options.  When you post a Goods Movement, you can use LB12 -display Transfer Requirement for material document or LB11 Display TR for material.
    Depending on how your system is set up you may have gotten a Transfer Order automcatically.  In this case you can look at LT24 - Transfer Order for material.

  • I'm trying to load a student version of Acrobat XI Pro but not sure how to get the serial number to validate I'm a student

    I'm trying to load a student version of Acrobat XI Pro but not sure how to get the serial number to validate I'm a student

    Hi ,
    Could you please tell me form where did you purchase the Student version of Acrobat ?Is it through Adobe or some outside vendor ?
    Is it the first time you are trying to access it ?
    If yes ,then you must have received your serial number along with your product .
    If not ,then how how did you manage to get your serial number and access Acrobat before ?
    Regards
    Sukrit Dhingra

  • How to get the delivery number for the sales order

    hi
    how to get the delivery number for the sales order

    Hi,
    1. IN VA03, enter the sales order and click on the document flow button. From there you can check the delivery document.
    2. In SE11, enter VBFA(Document flow) table and enter the sales order in VBELV field and in VBTYP_N field enter 'J' to specify that you want to check if there is already a delivery document for that sales order.
    Hope it helps...
    P.S. Please award points if it helps...

  • HT1529 If I do not have the macbook with me and in the bill is not writing? How to get the Serial Number true Itunes?

    If I do not have the macbook with me and in the bill is not writing? How to get the Serial Number true Itunes?

    https://support.apple.com/kb/HT2526

  • HT4061 last night I stole my ipad and not how to get the serial number I have the itunes account that I do

    last night I stole my ipad and not how to get the serial number I have the itunes account that I do

    What To Do If Your iDevice or Computer Is Lost Or Stolen
    If your Mac, iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should do in advance - before you lose it or it's stolen - and some things to do after the fact. Here are some suggestions:
    Reporting a lost or stolen Apple product
    What-To-Do-When-Iphone-Is-Stolen
    Lost or Stolen iPhone? Here’s What to do.
    6 Ways to Track and Recover Your Lost/Stolen iPhone
    Find My iPhone
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
    Find My iPhone
    Setup your iDevice on MobileMe
    OS X Lion- About Find My Mac
    How To Set Up Free Find Your iPhone (Even on Unsupported Devices)
    Third-party solutions for computers:
    VUWER 1.5.4
    Sneaky ******* 0.2.0
    Undercover 4.7
    LoJack for Laptops Premium Mac
    STEM 2.1

  • How to get the page number according to MarkerID?

    I want to get the page number according to the marker element in fdk. I can get the marktext and markid,How to get the page number according to MarkerID in fdk?

    zhaopeng,
    You need to first get the ID of the paragraph containing the marker (with FP_TextLoc), then get the top-level frame containing the FO_Pgf object (FP_InTextFrame), then get the page containing the FO_TextFrame object (FP_PageFramePage). Here is a function that you can send various objects to in order to get the page ID, including paragraphs (this courtesy of Rick Quatro, originally posted to the Yahoo Framedev list):
    F_ObjHandleT GetPage(F_ObjHandleT oDoc, F_ObjHandleT oObj)
      F_ObjHandleT oFrame = 0;
      IntT iObjType;
      F_ObjHandleT oRow, oCell;
      while(oObj)
        oFrame = oObj;
        iObjType = F_ApiGetObjectType(oDoc, oObj);
        switch(iObjType)
          case FO_SubCol:
          oObj = F_ApiGetId(oDoc, oObj, FP_ParentTextFrame);
          break;
          case FO_Tbl:
          oRow = F_ApiGetId(oDoc, oObj, FP_FirstRowInTbl);
          oCell = F_ApiGetId(oDoc, oRow, FP_FirstCellInRow);
          oObj = oCell;
          break;
          case FO_Row:
          oCell = F_ApiGetId(oDoc, oObj, FP_FirstCellInRow);
          oObj = oCell;
          break;
          case FO_Cell:
          case FO_Pgf:
          case FO_AFrame:
          oObj = F_ApiGetId(oDoc, oObj, FP_InTextFrame);
          break;
          case FO_TextLine:
          case FO_TextFrame:
          case FO_UnanchoredFrame:
          case FO_Arc:
          case FO_Ellipse:
          case FO_Group:
          case FO_Inset:
          case FO_Line:
          case FO_Math:
          case FO_Polygon:
          case FO_Polyline:
          case FO_Rectangle:
          case FO_RoundRect:
          oObj = F_ApiGetId(oDoc, oObj, FP_FrameParent);
          break;
          //endless loop prevention, stops the process when the top-level frame is reached
          default:
          oObj = 0;
          break;
      //if we found the top-level frame, return its page ID, otherwise null
      if(oFrame)
        return (F_ApiGetId(oDoc, oFrame, FP_PageFramePage));
      else return(0);
    ...so, you would do something like this if you have the marker ID:
    F_TextLocT textLoc;
    F_ObjHandleT pageId;
    textLoc = F_ApiGetId(docId, markerId, FP_TextLoc);
    pageId = GetPage(docId, pageId.objId);
    Note: I'm not sure how this handles the case where a paragraph extends across two pages and the marker is located on the second page. My thought is that it might erroneously return the page where the paragraph begins. I don't know how to handle that.
    Russ

  • How to get the Equipements number and desciption for the contract item ?

    Hi Gurus,
            How to get the Equipements number and desciption for the contract item items? It would gr8 helpful to me...
    VBAP,,EQUI,,,,,,?
    Thanks
    Krisna

    Check with below tables :
    EQUI    Equipment master data
    EQKT   Equipment short text
    EQUZ   Equipment time segment
    Thanks
    Seshu

  • How to get the values of Select-options from the screen.

    The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.

    Hi,
    Refer this following code..this will solve your problem...
    "Following code reads value entered in s_po select options and willprovide search
    "help for s_item depending upon s_po value.
    REPORT TEST.
    TABLES : ekpo.
    DATA: BEGIN OF itab OCCURS 0,
    ebelp LIKE ekpo-ebelp,
    END OF itab.
    SELECT-OPTIONS   s_po FOR ekpo-ebeln.
    SELECT-OPTIONS s_item FOR ekpo-ebelp.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
      DATA:
      dyn_field TYPE dynpread,
      temp_fields TYPE TABLE OF dynpread,
      zlv_dynpro TYPE syst-repid.
      zlv_dynpro = syst-repid.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname     = zlv_dynpro
          dynumb     = syst-dynnr
          request    = 'A'
        TABLES
          dynpfields = temp_fields
        EXCEPTIONS
          OTHERS     = 0.
      LOOP AT temp_fields INTO dyn_field.
        IF dyn_field-fieldname EQ 'S_PO-LOW'.
            SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
            WHERE ebeln EQ dyn_field-fieldvalue.
            EXIT.
        ENDIF.
      ENDLOOP.

Maybe you are looking for

  • Laserjet CP1025nw color black and magenta lights blinking

    Both the black and magenta cartridge lights are blinking even after replacing both with brand new genuine HP cartridges.  Printer will not print configuration page or status page.  It is completely unresponsive.   I've tried a full power reset - unpl

  • Unable to test Adobe interactive form from webdynpro

    This is the out put i get when i test run the report 'FP_TEST_IA_01'.As suggested in SAP NOTE : 999998 ADS: com.adobe.ProcessingException: Could not retrieve a password for credential: ReaderRights(200.101). Actually i was trying my first Adobe inter

  • Thinkvanta​ge Fingerprin​t Enrollment

    Im creating an image for the X61s and want the fingerprint enrollment to be optional.  I'd like to prevent the user enrollment from automatically starting after logon.  So, I need the fingerprint software installed, but dont want to be hassled for en

  • Xquartz finder not showing files

    Hello there, I have a problem, as soon as I install xquartz, Finder has troubles showing files in SOME folders. With terminal, all files are there and the permissions also look ok! As soon as I remove xquartz, it seems to work fine again, but I need

  • Groupware configuration

    Hi When a create a room with the standard SAP meeting room template i add some memebers with different roles.When ai login as a memeber an error occurs saying 'No connection to groupware server (Invalid RID: No repository manager found: /calendar). R