File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java.util.Date getYear() method is deprecated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java.util.Date getYear() method is deprecated" Watch "java.util.Date getYear() method is deprecated" New topic
Author

java.util.Date getYear() method is deprecated

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
java.util.Date getYear() method is deprecated, what is the best way to get the year value using JDK6 libraries (not third party open source Java libraries)?

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

By using java.util.Calendar. Create an instance, set its time to the Date object, then get the year.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
Rob Spoor wrote:By using java.util.Calendar. Create an instance, set its time to the Date object, then get the year.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

Exactly like that
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.util.Date getYear() method is deprecated