Calendar object changing date object when setTime(Date) is called

long tt = System.currentTimeMillis();
          Date d=new Date(tt);
          if (getUsePickedDate())
               d.setDate( getDay() );
               d.setMonth( getMonth() );
               d.setYear( getYear() );
          if (calendar==null)
               calendar = new GregorianCalendar();
          calendar.setTime(d);when I use d.setYear( getYear() ); where getYear returns 2010, rather than when getUsePickedDate == false the calendar.setTime(Date) changes the Date d object, specifically changing "cashedYear" to 3910 from 2010, I checked with the debugger, its 2010 going into this function and 3910 coming out...
the setYear() methods are depreciated for Date - but how am I supposed to use it? It seems they depreciated all the methods in Date...
Could anyone suggest an alternative way of going about the above?
Thanks
Joe
-edit 1 also, am i being stupid but where on earth are the code tags in this new forum??
-edit 2 found the post on them - really should put it on the panel at the side, (i was using  before stupid me!)
Edited by: 794057 on 21-Oct-2010 05:55
Edited by: 794057 on 21-Oct-2010 06:01

Do also note that the javadoc for Date.setYear says:
"Sets the year of this Date object to be the specified value plus 1900."

Similar Messages

  • Why does calendar keep changing dates and times on icloud

    My calendar keeps randomly changing dates and times when using icloud and it is doing my head in.
    Is there a simple way of rectifying this or do I have to get rid of icloud altogether (to save my sanity?)

    If this is an iCloud calendar, you might want to check your time zone and time zone support settings.  Go to icloud.com, sign into your iCloud account, click your name at the top and choose Account Settings, click Time Zone and be sure it shows the correct time zone and that you have selected a city near you.  Then open your calendar on icloud.com, click the gear-shaped icon on the bottom left and choose Preferences, click the Advanced tab and make sure you have not checked time zone support at the top.
    On your iOS devices, go to Settings>Mail,Contacts,Calendars>Time Zone Support (in the Calendars section) and make sure this is set to Off.

  • Changing data in called program

    Hi Gurus,
    I have an exit where I want to change the main program's internal table data dynamically in this exit FM.
    In short, I want to change the internal table data in calling program being in called FM.
    Can this be done? If so how?
    Regds

    You can change the data in a field in a program using field-symbols. The field-symbols acts as a pointer to a defined field. Change the field-symbol value will in turn change the value of the field. You can also assign the value of a field from a different program ( at runtime ) to a field symbol. But I beleive that in this circumstance changing the field-symbol will not change the actual field value.
    I had this same problem myself.

  • Date change problem in Calendar object

    Hi i have a calendar object for date representation.
    When i need to go ahead a day i use a add method that adds a day to the Calendar object, and if the date is out of range it adjustes proerly to the next montha and proper date in that next month.
    But it fails for 2 instances in a year.
    From May to June and From October to November.
    This i think is happenning because of the Daylight saving times in the May and October.
    I try to go from May to June but it never does on it's own !! Do i have to explicitly check that for those 2 months or there is any other method ?
    How can i get over it ??
    Please help me with this.
    Shailendra

    Hi
    There may be some other reason for it, coz Day light savings starts in last week of March, not in May.
    And day light savings ends in Last week of October
    Suresh

  • Changing data in a linked list object.

    hi,
    i'm still pretty new to java, so bear with me if i am making stupid mistakes, heh.
    i'm having trouble with changing data in an object stored in a singly-linked list. i've created a class that will store polynomials in sorted order (descending) in a singly-linked list. each linked list is one polynomial, and each node references to a polynomial object that stores two ints: the coefficient and the exponent of that term.
    i'm having trouble when it comes to 'collecting like terms,' though. here's a rough skeleton of my code:
    public class Polynomial
    private LinkedList polynoList;
    private LinkedListItr Itr;
    private int coeff;
    private int exponent;
    public Polynomial()
    zeroPolynomial();
    } // this constructor sets up an empty linked list
    public Polynomial( int c, int e )
    coeff = c;
    exponent = e;
    } // this creates a Polynomial object storing the two ints
    public void zeroPolynomial()
    polynoList = new LinkedList();
    theItr = polynoList.zeroth();
    } // this method creates the empty linked list and sets the
    //iterator on the zeroth node.
    //various other methods are here, not relevant to my post
    //this next method is the one i am having trouble with.
    //it takes two ints as parameters, the coefficient
    //and the exponent.
    public void insertTerm( int c, int e )
    //...i have a few if/then statements here
    //so that the terms can be inserted in descending order.
    LinkedListItr tester = polynoList.first();
    //the 'tester' iterator is set on the first node
    //this following if statement retrieves the exponent
    //in the current node by casting the information
    //retrieved from the LinkedList retrieve() method
    //into Polynomial, then compares it to the current
    //exponent. if they are equal, i want to add the
    //coefficients.
    if( e == ((Polynomial)tester.retrieve()).getExp() )
    this.coeff = ((Polynomial)tester.retrieve()).getCoeff() + c;
    //a main method goes here wherein the user can insert
    //terms, print the polynomial, etc.
    }//end Polynomial class
    can anyone help me out? the code i'm using compiles correctly, but it does not change the value of the current coeff variable as i'd like to think it should. any input would be GREATLY appreciated, thanks!

    hey,
    thanks for the reply...
    i am sure that ((Polynomial)tester.retrieve()).getExp() will return an int equal to 'e.' i tried this:
    System.out.println("e="+e);
    System.out.println((Polynomial)tester.retrieve()).getExp());
    if( e == ((Polynomial)tester.retrieve()).getExp() ){
    this.coeff = ((Polynomial)tester.retrieve()).getCoeff() + c;
    System.out.println( "this.coeff = " + this.coeff );
    with that, the output showed that e and the getExp() output were the same. it also showed (as output) that this.coeff did change in value, but when i tried this:
    System.out.println( ((Polynomial)tester.retrieve()).getCoeff() )
    to check if the value changed within the object, it didn't. this.coeff changed, but the actual coeff variable in the object didn't.
    any ideas?

  • Using Frame API for C, Need to change Data size for a TX Object

    I need to Transmit different messages to the same ArbitrationID address. The Transmited messages have variable lengths. Can I call ncConfig on an object to change the NC_ATTR_CAN_DATA_LENGTH even after the call to ncOpenObject. Or do I have to Close the object and reopen it after the call to ncConfig?
    Thanks!

    Hello Genesis,
    your second assumption is right. You do have to close, reconfigure and reopen the object in order to change the data length.
    As long as you're using the CAN Object in the 'Transmit Data by Call' mode only, you might want to consider using the Network Interface for transmitting. When you use the Network Interface, you can change the ArbitrationID for each write call.
    -B2k

  • Printing Date with Calendar Object

    I am trying to print the current date of a calender object in a mm/dd/yyyy format.
    When I call system.out.println(now.getInstance()); and scroll through the console, it shows DAY_OF_MONTH=29, YEAR=2006, MONTH=6 for July 29, 2006. I realize months are zero based, so month is really 7. My question is, why does:
    System.out.println(now.MONTH + " " + now.DAY_OF_MONTH + " " + now.YEAR);
    print 2 5 1.
    Logic tells me it should print 6 29 2006.
    I have searched previous posts, and couldn't find one that answers my question. How do I take a Calendar object and print its current set date?

    My question is, why does:My question is: why do you care how a Calendar stores its data? If you want to print it, get a Date instance from it and run it through a SimpleDateFormat to get a String representation of the date.
    Don't mix up data and presentation.
    And to answer your question: you don't print the Calendar's date attributes, but the values of some static constants.

  • How to change Data Object

    Hi everyone,
    I m trying to change from one D.O. to another using the "Global Change Data Object" at BAM Active Studio, but when I find the D.O. wich I want to use the radio button its greyed out. I really need to change the D.O. and I dont see how to do it.
    Thanks in advance,
    Mario Mesquita

    It will only let you change dataobjects if all the fields are identical to the reports current dataobject.

  • Convert Date Object to Calendar object

    Hi,
    I have a Date field in my webdynpro application, I need to to read this from my current context and convert the same to a Calendar field and pass it to my model.
    Calendar date = CalendarConverter.parseDate(req_date.toString());
    The above code gives me a null pointer exception.
    Can anyone suggest me the right way of converting a Date object to Calendar object?
    Ashwini.

    Ashwini,
    try to use the following code snippet:
    // get calendar and set your date object
    Calendar c = Calendar.getInstance();
    c.setTime( <YOUR_DATE_OBJECT> );
    // to manipulate the fields use this
    c.set(Calendar.MONTH, 1);
    // to manipulate retrieve a fields use this
    c.get(Calendar.MONTH);
    Hope that helps you.
    Sebastian Voss

  • Changing Data Source for command objects

    Hi,
    My report (designed in CR 10) is running based on the Stored Procedure call using a command object; which is running successfully in the DEV environment. The report data source connectivity is a DSN.
    Now i want to switch it to QA environment with different DSN name. When i tried to update the Change Data Source option, it doesn't allows to update the existing command with a new command!!!!
    I don't know how to fix this. Could any one of you have idea, pls. share it here???
    Thanks
    Viswa

    If you have same table structure in new data source then you can change the datasource connection.
    Follow the steps in this article
    KBase Article ID:c2016958
    Article refers to:Crystal Reports 10
    Symptom
    In Crystal Reports (CR) 10, can you change the database connection of an existing command object to use a different database connection without the use of a Crystal Repository?
    Resolution
    Yes, you can change the database connection of an existing command object to use a different database connection without the use of a Crystal Repository by using the following steps:
    ====================
    NOTE:
    You must apply the CR 10 Monthly Hot Fix (cr10win_en.zip) and the CR 10 Database and Export Drivers Monthly Hot Fix (dbex10win_en.zip) before starting the steps below.
    You can download these hot fixes at http://support.businessobjects.com/search
    ====================
    1. Open a report with a command object.
    2. Go the 'Database' menu and click 'Set Datasource Location'.
    3. In the 'Set Datasource Location' dialog box, select the connection for the command object (the connection appears as a cylinder with a plug).
    4. In the lower window, select the new connection and log on to the database.
    5. Ensure the connection is highlighted for the command object in the top window, and the connection is highlighted for the new command object in the bottom window.
    6. Click Update.
    The database connection for the command object now changes to use the new database connection information.
    Regards,
    Raghavendra

  • Can we change data in string object.

    Can we change data in string object.

    Saw this hack to access the char[]'s in a String in another thread. Beware that the effects of doing this is possible errors, like incorrect hashCode etc.
    import java.lang.reflect.*;
    public class SharedString {
            public static Constructor stringWrap = null;
            public static String wrap(char[] value, int offset, int length) {
                    try {
                            if (stringWrap == null) {
                                    stringWrap = String.class.getDeclaredConstructor(new Class[] { Integer.TYPE, Integer.TYPE, char[].class });
                                    stringWrap.setAccessible(true);
                            return (String)stringWrap.newInstance(new Object[] { new Integer(offset), new Integer(length), value });
                    catch (java.lang.NoSuchMethodException e) {
                            System.err.println ("NoMethod exception caught: " + e);
                    catch (java.lang.IllegalAccessException e) {
                            System.err.println ("Access exception caught: " + e);
                    catch (java.lang.InstantiationException e) {
                            System.err.println ("Instantiation exception caught: " + e);
                    catch (java.lang.reflect.InvocationTargetException e) {
                            System.err.println ("Invocation exception caught: " + e);
                    return null;
            public static void main(String[] args) {
                    char[] chars = new char[] { 'l', 'e', 'v', 'i', '_', 'h' };
                    String test = SharedString.wrap(chars, 0, chars.length);
                    System.out.println("String test = " + test);
                    chars[0] = 'k';
                    chars[1] = 'a';
                    chars[2] = 'l';
                    chars[3] = 'l';
                    chars[4] = 'a';
                    chars[5] = 'n';
                    System.out.println("String test = " + test);
    } Gil

  • Convert a calendar object to a date object

    hi all...i use a calendar to select date and i want to convert the Calendar object returned to a date object ..how could i do that ?? i use the following lines of code but the Date object returned is not correct ..i mean it's not the one i chose from the calendar
    Date selectedDate=new Date();
    selectedDate=(calendar1.getTime());
    Any one could help....thank you

    Show us the code where you set the calendar to your desired value. Calendar1.getTime()
    should return the relevant date.

  • Need FM to get Last change date of Objects in package

    Hi All,
      Is there any Function module to get Last changed date of all Objects in a package .
      How to get the last change date of class,methods,function module.....
      I can get last change date of programs from TRDIR....UDAT....Similarly how can I get for Function Module and Class Methods. 
    With Thanks,
    Dina.
    Message was edited by: Dinamol Sasidharan

    Go/double click on the affected cubes you want to see the time stamp.
    click the Extras(tab on the upper of part of SAP) or simply 'Ctrl + F5'.
    Box will appear.
    Click on Logs for Save/Activate so you will see the linfo for the users who used this cube.
    Then put time restriction for From and To(always the current day and time).
    Then execute, all of the users who changed then saved/activated that cube will appear on that timeframe you view.
    Hope this help.

  • My calendar has stopped working, it either doesn't open at all (tap on it and it appears to opn but closes straight away) or if it does open when I try to change dates, it closes itself. t

    My calendar has stopped working. It either doesn't open at all (tapping on it it flashes on screen and closes straight away), or if it does stay open, eh. I try to change date or closes. Extremely frustrating. I have loads of entries in my calendar that I now can't access.

    Have you tried closing the Calendar app via the multitasking bar and seeing if it works when you re-open it ? Double-click the home button to open the taskbar, and then swipe or drag the Calendar app's screen from there up and off the top of the screen to close it, and click the home button to close the taskbar.
    If that doesn't fix it then you could try a soft-reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Regarding Authorization object's changed date..

    Hi All,
    Could someone help me, I wanna a table name which holds the changed/modify date for Authorization object..
    e.g. change date for S_TCODE etc.....
    Regards,
    Ankur

    Hi,
    Try Trx SU21, search for S_QUERY with Find button, double click on S_QUERY Object and Click on Permitted Activities. Use the Display<->Change Button for Modify.
    Angelo.

Maybe you are looking for

  • Importing from iMovie HD project

    I bought a new iMac and i'm importing in iMovie 08 a project from iMovie06. But i have 2 problems: first not all the clips are imported and second that the clips that are imported are not in the same order of the original projct. Does anyone have any

  • Business Area required

    Hello, When trying to post the billing document from SD, I am getting the error F5808 'Field Bus. Area is a required field for G/L account XX12 430000' 'The vaule for field "Bus. Area" in the interface to Financial Accounting is an initial value but

  • How CS5 Help should work.

    First of all, perhaps someone should get around to renaming this forum to something like "Community Help Viewer Application". Most of the posts in here are from people who think this is a general forum to get help from the community. What did you thi

  • Sequential Read on table BSAD

    Hello All Our custom program job when observed thru SM51 is spending over 4 hours at a single point showing SEQUENTIAL READ on table BSAD. DB2 provided us with the queries that were executed during runtime trying to fetch data from table BSAD SELECT

  • Error download ibooks author from app store

    Help! Error download ibooks author from app store!