Question concerning SimpleDateFormat returning week information

Hello,
I am just trying to get returned a date value with the format 'ww/yyyy' and experience problems in getting the correct value around the turn of the year.
Example:
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("w/yyyy");
df.getCalendar().setFirstDayOfWeek(java.util.Calendar.MONDAY);
df.getCalendar().setMinimalDaysInFirstWeek(4);
System.out.println(df.format(new java.sql.Date(103,11,31))); //Dez, 31, 2003As output I get "01/2003" which is not correct - I expected "01/2004" instead.
How do I get the correct output?
Do I have miscoded there something or is this a bug?
BTW: when trying the same with Jan, 1, 2004 I get the correct output.
Thank you for any answers
Ralf

From the API documentation for java.util.Calendar:
"The first week of a month or year is defined as the earliest seven day period beginning on getFirstDayOfWeek() and containing at least getMinimalDaysInFirstWeek() days of that month or year."
So, since December 31 2003 was on a Wednesday and you've defined your weeks to start on Monday, there were 3 days of 2003 and 4 days of 2004 in the week containing that date. And since your "minimal days in first week" is defined to be 4, this week is the first week of 2004. In other words, its week number is 1.
So that's why you see week number 1. (A week has only one week number.)
And since December 31 2003 was in 2003, you see 2003 for the year.
If you experiment a bit more with GregorianCalendar and callcal.get(Calendar.WEEK_OF_YEAR)for various dates, you should see what is going on.
If you want the "correct" output (in other words the output you want to see, whatever it is) then you can subclass GregorianCalendar and override its get method.

Similar Messages

  • My question concerns the ipad monthly calendar view.

    My question concerns the ipad monthly calendar view.  An all day event spans two days in the monthly calendar view.  Is this a bug?

    The entry is correct in day and week view.  In the month view, the event carries to the next day indicating it ends at 12:00am.

  • Question concerning Tiger installation

    Hello,
    currently I have OS X 10.2.8 and most recently I bought tiger...I have a question concerning the installation process. I inserted the disk and completed the first couple of installation steps and when I get to the 3rd step to choose a hard dive to install the operating system on, my slave drive is the only option that appears, not my mac hd drive that already has the current operating system on it...should i install tiger on my slave drive or is there a way to get my home drive as an option?? I have more available space on my mac hd drive and would say that it is the main drive that contains all the information to run this computer....
    any info on this matter would be greatly appreciated.....peter
    Dual 1.25 GHz G4   Mac OS X (10.4.3)  

    when selecting the startup disk, should there always be a ? mark on the drive icon? Well, i selected the mac osx2.8 system and will try the process again.....thanks....
    Dual 1.25 GHz G4   Mac OS X (10.2.x)  

  • Question concerning executing of sql

    Hallo,
    I have a question concerning the execution of sql-statements.
    I have a database and different applications that work with this database. When I now have a session and this session sends statements that should be executed.
    I want to ensure that the application can not execute all statements. What I want is a possibility that before a statement is executed there is a warning.
    Is there something in oracle database. Something that I can tie down to a table or a view.
    Any help appreciated.
    Thanks

    Hi,
    I have a question concerning the execution of sql-statements.
    I have a database and different applications that work with this database. When I now have a session and this session sends statements that should be executed.
    I want to ensure that the application can not execute all statements. What I want is a possibility that before a statement is executed there is a warning.
    As per my understanding see, Does your application is executing the series of Queries directly from the Frontend environment for Calling any Stored procedure to do the necessary Job.
    In case of queries, then say try to use some schema, where and what ever you want to keep the restrictions on certains table / Access grant respective Rights to some role and assign to the required schema.
    So, In case if you want restrict some thing make your application to connect with respect user.
    Else the above option is not possbile from your end then I think at table you can not restrict or raise any alerts or warnings, until the user don't have access to table. Other check with DBMS_ALERT, yoy might find any relavant thing for your problem.
    If you are using stored procedures, then you can able achive that, that Send an Additional parameter Is_Access or Is_Executable. This parameter send the boolean values true or false or 1 or 2 as per your checking feasibility, at code level, make sure than when ever you need send the warning send appopriate boolean value and which return the message from stored procedure (out parameter ) to application and will not execute the Code, If appopriate Boolean value is send from application call , then perform the Business transaction as per requirement.
    If I am missing from your requirement perspective, then I am sorry...
    - Pavan Kumar N

  • Question concerning sap script

    Hi all experts! I have a question concerning sap script
    First some background information:
    I’ve created a sap script  that is called from a function module and from an executable program,  when I run the executable program the sap script work fine, but when I run the function module, all the variables in the sap script don’t have value
    In the function module the variables are defined in the top include
    I don’t know why these variables don’t take his value from the function module
    Any ideas?
    Thanks in advance.
    Message was edited by: Gerardo hernandez

    I think that sapscript expects its variables to be in the program which calls the fm <b>by default</b>. When you test via SE37 the framework itself is the calling program and it's unlikely that it will have a variable named kunnr-name1.
    To over-ride this default, inside your fm pass the 'options' parameter(type itcpo) to 'open_form' and set the 'tdprogram' value to sy-repid in the function module.
    I have tested this in my own environemnt and initially got the same error as you. When I set the tdprogram variable it started working!

  • I have a MacBook Pro running 10.6.8 model 7.1; need to upgrade to Mavericks.  My question concerns 3 software apps:  Reunion 10, Quicken 2007, Appleworks 6.2.9.  Any recommendations?

    I have a MacBook Pro model 7.1 running 10.6.8; need to upgrade to Mavericks...question concerns 3 software apps:  Reunion 10, Quicken 2007, Appleworks 6.2.9 (word processing docs).  Any recommendations?

    Quicken Essentials is universally loathed on this forum.  Quicken 2007 updated for Lion, Mt. Lion and Mavericks for $15 is the way to go:
    http://quicken.intuit.com/personal-finance-software/quicken-2007-osx-lion.jsp
    Appleworks 6:
    Partition your hard drive or add an external drive and install Snow Leopard and use the "dual-boot" method to run Appleworks; and/or
    Install Snow Leopard Server (available by telephone order only from the Apple Store 1.800.MYAPPLE [1.800.692.7753]; part number - MC588Z/A) into Parallels and run Appleworks (and most other PowerPC apps) concurrently with Mavericks:
                                  [click on image to enlarge]
    Review Roger Wilmut's excellent series of articles, Abandoning Appleworks:
    http://www.wilmut.webspace.virginmedia.com/notes/aw/page1.html

  • Good afternoon ladies and gentlemen!   My question concerns the impossibility to open RAW-files directly from the program Adobe Bridge. At the moment when you open a RAW-file from Adobe Bridge by double-clicking, RAW-file is opened only in Photoshop. In t

    Good afternoon ladies and gentlemen!
    My question concerns the impossibility to open RAW-files directly from the program Adobe Bridge. At the moment when you open a RAW-file from Adobe Bridge by double-clicking, RAW-file is opened only in Photoshop. In the settings Adobe Bridge - in "open RAW-files by double-clicking in Adobe Camera Raw» box is checked. When you try any changes in the settings Adobe Bridge system displays a message:
    Bridge's parent application is not active. Bridge requires that a qualifying product has been launched at least once to enable this feature.
    The entire line of Adobe products on my computer updated to the latest updates. Previously, a family of products Adobe Photoshop on your computer is not set. Computer - PC, Windows 7 Enterprises.

    <moved from Adobe Creative Cloud to Bridge General Discussion>

  • Master iPad configurator question concerning cart syncing with different versions of iPads.

    I have a question concerning configurator syncing.Can the master iPad be a different version of iPad than the other synced iPads? For instance can iPad 2 be the master iPad to a group of iPad Air's? The iPad 2 has some fewer capabilities than the Air, would some settings or restrictions be left off of the iPad Airs if they were set up this way?  Thanks.

    There is no such thing as 'master iPad'.  If you're using Configurator or Profile Manager control of the setup is done from a Macintosh.

  • Might go for T400/500- Many questions concerning Think Vantage

    Hi,
    I am deciding on my first IBM, a T400 or T500
    I have a few questions concerning the Think Vantage Function:
    a) Does the recovery DVD set back the hard drive partitions to factory settings?
    b) Does the Think Vantage function set back the hard drive partitions to factory settings?
    This means the original size of the partitions, when they have been changed manually.
    c) Does Think Vantage work with a self buyed Windows Vista?
    d) Does Think Vantage work unter Windows XP
    e) Does Think Vantage need drivers/ anything else to work or is it entirly working on the hardware side, so no software/ windows is needed
    f)Will Think Vantage work under Windows 7 in a T400/500
    g) How was the past situation? Did a under Windows XP working Think Vantage also work on Vista / have there been drivers delivered, when needed, for the new OS
    h) Is it possible to set up a new OS (like Vista Ultimate) and then backup it up on a external hard drive and later recover from this?
    What do I want to achieve?
    I want to recover the factory settings at all times, this means partition size, number of partitions etc. and Windows Vista Business. Then I want to install Vista Ultimate do my settings and backing it up to an external drive or whatever and then recover from that all 3 Months. In the end I should be able to set back factory settings with the earliest/ first backup from Windows Business; Furthermore I might want to install Windows 7 sometimes.
    Thank you for your help! Kind regards
    Message Edited by Schwenker on 11-23-2008 08:23 AM

    Hello,
    I would recommend Acronis to do this job. Here is a link at thinkpad-forum.de.
    You´ll  get Acronis for free if you buy a PCWelt.
    Your answers:
    A. yes
    B: yes
    C: yes
    D: yes
    E: No, windows is needed and if it´s XP than MS NET 2.0 also.
    F: yes, when windows 7 is out, than Thinkvantage will work then, on Server 2008 it seems to work.
    G:Thinkvantage work in Vista and XP environment.
    H: yes, you can backup it on a extern hdd and later recover the R&R Image to the internal disc.
    What do I want to achieve?
    I would recommend Acronis to do this job. Here is a link at thinkpad-forum.de.
    You´ll  get Acronis for free, if you buy a PCWelt.
    here are some interesting benchmark with first versions of Windows 7 and XP.
    Windows 7 unmasked
    Perceptions becomes reality
    Message Edited by Agotthelf on 23-11-2008 10:23 PM
    Follow @LenovoForums on Twitter! Try the forum search, before first posting: Forum Search Option
    Please insert your type, model (not S/N) number and used OS in your posts.
    I´m a volunteer here using New X1 Carbon, ThinkPad Yoga, Yoga 11s, Yoga 13, T430s,T510, X220t, IdeaCentre B540.
    TIP: If your computer runs satisfactorily now, it may not be necessary to update the system.
     English Community       Deutsche Community       Comunidad en Español

  • Function module that will return week  details

    Anyone know Sap FM that will return Week  details(as below)for a given start and end dates (similar to the function module HR_99S_INTERVAL_BETWEEN_DATES which  returns details for a month) independent of factory calendar
    I am expecting
    Inputs
    Start Date  - 01/01/2005
    End Date   -  05/05/2006
    outputs
    WK YEAR BEGDA      ENDDA      
    02 2005 01/03/2005 01/09/2005 
    03 2005 01/10/2005 01/16/2005 
    04 2005 01/01/2005 01/23/2005
    Thank, Bill

    Hi Bill,
    FM is <b>GET_WEEK_INFO_BASED_ON_DATE</b>
    Here's a test-program for your requirement:
    REPORT zforum09 LINE-SIZE 255.
    PARAMETERS:fdate  LIKE sy-datum DEFAULT '20050103',
               tdate  LIKE sy-datum DEFAULT '20060505'.
    DATA : BEGIN OF itab OCCURS 0,
           week LIKE scal-week,
           from LIKE sy-datum,
           to LIKE sy-datum,
           END OF itab,
           next LIKE sy-datum.
    next = fdate.
    WHILE tdate > itab-to.
      CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
           EXPORTING
                date   = next
           IMPORTING
                week   = itab-week
                monday = itab-from
                sunday = itab-to.
      next = itab-from + 7.
      APPEND itab.
    ENDWHILE.
    LOOP AT itab.
      WRITE:/ itab-week+4(2),
              itab-week(4),
              itab-from,
              itab-to.
    ENDLOOP.
    Regards Andreas

  • Questions concerning ST Simple Transformations

    I got some questions concerning Simple Transformations:
    1.) When editing a simple transformation, how to insert comments? In pure ABAP, a comment line must have as asterisk in the first column...
    2.) I use <tt:loop>...</tt:loop> and want to use the index of the currently processed entry, like SY-TABIX when implementing a "LOOP AT itab" in ABAP. Is there a way?
    Thanks for your answer, points will be rewared...
    -MIKE

    Hi Jack, please find some sample coding below that will solve your issue:
    <tt:cond check="not-initial(ref('E1EDL20.INCO1'))">
      <INCO1 tt:value-ref="E1EDL20.INCO1"/>
    </tt:cond>
    With the simple transformation tt cond statment you can make an XML tag optional. In below example during deserialisation xml tag <INCO1> will be skipped when not availabke in the xml and SAP data E1EDL20.INCO1 will not be filled by the transformation.
    Regards. Please give points when usefull !

  • Return Cell information in a Table

    Hi,
    I have a table component with 5 rows and 6 colums and the only item i can select is a position or row.
    Is there any way i can return the information of a particular cell. Or is there any other component that can fetch me the same funcionality? I have data in the table and i have underlined them to show them as links. When users choose a particular cell i want the particular link to open.
    Regards
    Ji

    Hi,
    Are Row6.ph2 and Row7.Cell3 numeric fields ?
    It seems that you're using Javascript. In this case, you should access the value of a field using rawValue (ie Row6.ph2.rawValue).
    You also need to give a relative (this.parent ...) or absolute path (xfa.resolveNode("form.table.Row7")) to access Row6 and Row7, for example :
    this.rawValue=(Number(this.parent.Row6.ph2.rawValue) + Number(this.parent.Row7.Cell3.rawValue));
    if Row6 and Row7 are in the same subform as the total field.
    After testing the script quickly, it seems that if you put the rest of the script in the layoutReady event, it works fine.
    if (this.rawValue <8) {
         this.presence = "hidden";
    } else {
         this.rawValue = this.rawValue - 8;
         this.presence = "visible";
    I don't really know why it doesn't work in the calculate event, there is no error in the javascript console ...
    Anyway, be careful with the layoutReady event though, because if you have a really big form and a lot of script in this event, this could slow the execution / display of your form.
    Regards,
    Thomas

  • Question Concerning Anchor Usage

    New to Dreamweaver's web world and have a question concerning
    Anchors and Drop Down Menus. Is it possible to have one of the
    selections from my main navigation drop down menu Anchored to a
    particular section of a page?
    Thank You for any input.

    OH, that. Duh.... 8)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "E Michael Brandt" <[email protected]> wrote
    in message
    news:fu5vq2$gs1$[email protected]..
    > jcraw77 wrote:
    >> New to Dreamweaver's web world and have a question
    concerning Anchors and
    >> Drop Down Menus. Is it possible to have one of the
    selections from my
    >> main navigation drop down menu Anchored to a
    particular section of a
    >> page?
    >>
    >> Thank You for any input.
    >
    > Sure, just make its link be href="#anchorname"
    >
    > --
    >
    >
    > E. Michael Brandt
    >
    > www.divahtml.com
    >
    www.divahtml.com/products/scripts_dreamweaver_extensions.php
    > Standards-compliant scripts and Dreamweaver Extensions
    >
    > www.valleywebdesigns.com/vwd_Vdw.asp
    > JustSo PictureWindow
    > JustSo PhotoAlbum, et alia
    >
    > --

  • Question concerning Servicing

    Hey all.
    I have a question concerning the servicing of my Macbook.
    My laptop (less than a year old and still under warrenty) has several dead pixels on the display and the case has developed a chip on the palm rest when the display lid (prongs) meets the palm rest (I believe that this is a popular problem). I did initiate a self repair on the chipped palm rest with super glue to fix it temporarily.
    The question is if i take my laptop to the Genius bar, will I be able to get both the screen repaired and the palm rest repaired. And if so how long do you think it will take to replace both and any indication about costs.

    jfdm wrote:
    Hey all.
    I have a question concerning the servicing of my Macbook.
    My laptop (less than a year old and still under warrenty) has several dead pixels on the display and the case has developed a chip on the palm rest when the display lid (prongs) meets the palm rest (I believe that this is a popular problem). I did initiate a self repair on the chipped palm rest with super glue to fix it temporarily.
    The question is if i take my laptop to the Genius bar, will I be able to get both the screen repaired and the palm rest repaired. And if so how long do you think it will take to replace both and any indication about costs.
    I would think you would have no problem with just a simple super-gluing of the palm rest, provided you didn't get it all over the rest of the case. Dead pixels may be another issue. Industry standards say that a certain amount of dead pixels are acceptable. Yield would go way down if all LCD panels were required to be perfect and stay perfect. Your best course of action is to make an appointment and ask. Good luck.

  • Question concerning KW Content Update

    Hello,
    I have a question concerning updating the KW content: On the Content Update DVDs are *.KWE files. What should I do with this files? Must I also import these files with my batch file like the *.SAP files?
    Could someone help me?
    Thanks
    Edited by: Malte Jacobi on Apr 8, 2008 8:39 AM

    "And Custom Tags scares me"Then you better dont read to many posts in this forum.
    and maybe not the rest of my post either
    With JSTL
    Here all common fields
    <c:choose>
        <c:when test="${test to see if its a landlord}">
              All the landlord field here
         <c:when>
        <c:otherwise>
              All the not landlord  fields here
         <c:otherwise>
    </c:choose>

Maybe you are looking for

  • Missing Tables and Indexes

    Hi all, we have checked "missing table and indexs" status with DBACOCKPIT and there it show 362 Indexes are not created. all are the standard table indexes. we have updated the indexes and statistics with BRCONNECT also.and its complited successfully

  • RA-14400: inserted partition key does not map to any partition

    Our repository tablespace filledup alll 40GB allocated and over the weekend we stopped OMS agenets and ran the package for partition maintenance. exec emd_maint_util.partition_maintenance; Now after starting OMS, all xml files are gettting moved erro

  • Home tab A-Z in Microsoft word document. doesnt work

    I am trying to arrange my references alphabetically using the home tab A-Z in Microsoft word document. But it didn't work, and i got a pop up window stating that '' Word cannot sort field in the selection. Any advices?

  • Invitation Replies

    I do not receive invitation replies for my invitees. I am using 3GS with iOS 5. What I did was I tried sending out invitation to my wife (sitting beside me) and when she replies to my invitation, I do not get an notification on her reply unless I go

  • Video Filter - Basic 3D Question

    Oh great and wise ones, Basic 3D Filter question. Problem, whenever you have an image/video clip twisted along its axis via the Basic 3D filter, the corners/edges get cut off. Are there any filters/tricks to manipulating an object in 3D space? I'm no