In this example, you will see the use of getDate() method of Date class in java.
Use of getDate() method of Date class in java.
In this example, you will see the use of getDate() method of java Date class. It returns the day of the month for the specified date object, the value of according to local time. The value returned is between 1 and 31 representing the day of the month.
Code:
import java.text.SimpleDateFormat; import java.util.Date; public class GetDateMethod { public static void main(String[] args) { Date obDate = new Date(); SimpleDateFormat obDateFormat = new SimpleDateFormat("yyyy-MM-dd"); System.out.println("Current Date of system :" + obDateFormat.format(obDate.getTime())); System.out.println("Day of given date : " + obDate.getDate()); } }Output
Current Date of system :2010-11-25
Day of given date : 25 |
[ 0 ] Comments