Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deprecated API: Date.getYear  RSS feed

 
Craig Snowbarger
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use this code to retrieve the current year:

But, the compiler says it is deprecated. Does anyone know of an easy method to get the current year?
Regards,
Craig Snowbarger
 
Craig Snowbarger
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind! I figured it out. I new it was easy!


Regards,
Craig Snowbarger
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API available at the Sun web site says this about Date.getYear():

Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.YEAR) - 1900.
 
Craig Snowbarger
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!