aspose 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
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: 249
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: 19794
    
  20

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: 249
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: 19794
    
  20

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