How do I get date, month, year values from the current date?
Category: java.util, viewed: 113288 time(s).
What date, month, year, day-of-week, day-of-month, day-of-year is it today? If we want to answer these question we can use java.util.Calendar and java.util.GregorianCalendar which is the implementation of Calendar abstract class.
These classes can help us to get integer value such as date, month, year from a Date object. Let's see the example code.
Here is the result of this example:
Current Date: Thu Dec 29 13:41:09 ICT 2005 Day: 29 Month: 12 Year: 2005 Day of Week: 5 Day of Month: 29 Day of Year: 363
Can't find what you are looking for? Join our FORUMS and ask some questions!
Download Hundreds of Complimentary Industry Resources
Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more;
all available at no cost to you. With more than 600 complimentary offers, you'll find
plenty of titles to suit your professional interests and needs.
Click Here and Sign up today!
