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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 239
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: 19541
    
  16

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: 239
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: 19541
    
  16

Exactly like that
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.util.Date getYear() method is deprecated
 
Similar Threads
compiles with warning?
get the year?
Garbage Collection
a problem with Date class
Alternative to deprecated Date.toGMTString()