In this section you will study how to retrieve the year from the date. You can see in the given example that we have called SimpleDateFormat class showing the format of year. The method simpleDateformat.format(date) formats a Date into a date/time string and returns the year.
Here is the code of GetYearFromDate
Output will be displayed as:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Java get year from date
Post your Comment