Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 23-09-2009
Member
 
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.
Reply With Quote
  #2  
Old 23-09-2009
Member
 
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);
Reply With Quote
  #3  
Old 23-09-2009
Member
 
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.
Reply With Quote
  #4  
Old 23-09-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Implement Date Deprecated method in an Application"
Thread Thread Starter Forum Replies Last Post
What is the date of IES and PSU exam application form Blake's Education Career and Job Discussions 2 04-06-2012 01:03 PM
Method to Run Java Application of Mobile in PC using KEmulator Lite Jay Scott Tips & Tweaks 4 07-03-2011 12:41 AM
Problem in GetMode() method of calculator application. Juany Software Development 5 18-02-2010 05:03 PM
How to Implement .net dependency injection in .NET Application Paramartha Software Development 3 11-08-2009 03:17 PM
Display System date & time to VB application VijayW Software Development 3 16-02-2009 07:53 PM


All times are GMT +5.5. The time now is 06:28 AM.