Results 1 to 4 of 4

Thread: How to Implement Date Deprecated method in an Application

  1. #1
    Join Date
    Dec 2008
    Posts
    70

    How to Implement Date Deprecated method in an Application

    I am very much interested in implementing Date Deprecated method in my java application, I have develop the code for same but unable to get the logic concept for the whole program, I am very much sure that the code i have developed will not work, please give me your suggestion on how to implement Date function.

  2. #2
    Join Date
    Nov 2008
    Posts
    58

    Re: How to Implement Date Deprecated method in an Application

    It looks like nothing remains for java.util.Date to do. So should we leave it for dead and go on to other things? I don't know what is going on, but your snippet runs fine without exception and with the correct result?
    It should, the format is also mentioned in the javadoc of the SimpleDateFormat class. No, java.util.Date still has an important role. A java.util.Date is a value object.

    Code:
    Date curDate = new Date();
    Calendar pal = Calendar.getInstance();
    pal.setTime(curDate);
    int year = pal.get(Calendar.YEAR);

  3. #3
    Join Date
    Feb 2006
    Posts
    90

    Re: How to Implement Date Deprecated method in an Application

    Usually deprecated method javadoc will give you a hint as to the better way. In your case, Calendar is the recommended way to do this. Another way to think about a java.util.Date is that it is a variation of the Memento or Token pattern. It simply holds state -- a value. It serves somewhat the same role java.lang.Integer; it's just a typed container. While it's conceivable that they will be removed at some point in the future, I wouldn't bet on it.

  4. #4
    Join Date
    Jan 2009
    Posts
    96

    Re: How to Implement Date Deprecated method in an Application

    GregorianCalendar also contains an array of values for holding all of the various fields it knows how calculate. One problem is you'll see lots of compiler warnings about using deprecated methods. If you also use deprecations to gradually phase out your own code, the compiler warnings will get lost in the noise and lose significance. All of this additional information as part of its extensive internal state, makes GregorianCalendar many tens of times larger than the much simplier java.util.Date.

Similar Threads

  1. What is the date of IES and PSU exam application form
    By Blake's in forum Education Career and Job Discussions
    Replies: 2
    Last Post: 04-06-2012, 01:03 PM
  2. Replies: 4
    Last Post: 07-03-2011, 12:41 AM
  3. Problem in GetMode() method of calculator application.
    By Juany in forum Software Development
    Replies: 5
    Last Post: 18-02-2010, 05:03 PM
  4. How to Implement .net dependency injection in .NET Application
    By Paramartha in forum Software Development
    Replies: 3
    Last Post: 11-08-2009, 03:17 PM
  5. Display System date & time to VB application
    By VijayW in forum Software Development
    Replies: 3
    Last Post: 16-02-2009, 07:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,484,578.54307 seconds with 17 queries