It will function, but it may not be a bad idea to start thinking about alternatives.
getYear is deprecated for some reason; the year associated with the date actually depends on the Locale and as such has been moved to the Calendar class. This remodeling of the Date class, which extracts the Locale dependency on the data itself, is what you also see in other date / calendar related functions. Thus, it may be wise to switch to Calendars where necessary.
However, I would not touch on Date / Calendar material from a java stick, I prefer things like Apache Commons Lang and others to deal with most materials related to date and time. I also heard that Yoda is popular in this regard.
extraneon
source share