|
| |||||||||
| Tags: date deprecated method, implement date, java application |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| 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
| |||
| |||
| 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
| ||||
| ||||
| 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
| |||
| |||
| 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. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to Implement Date Deprecated method in an Application" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Method to Run Java Application of Mobile in PC using KEmulator Lite | Jay Scott | Tips & Tweaks | 4 | 07-03-2011 12:41 AM |
| windows mobile:Installing an application - date and time eror | Taryn | Portable Devices | 4 | 19-10-2010 07:55 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 04:17 PM |
| Display System date & time to VB application | VijayW | Software Development | 3 | 16-02-2009 07:53 PM |