/*
* 'findDay' function
*
* The function is expected to return a STRING.
* The function accepts following parameters:
* 1. INTEGER month
* 2. INTEGER day
* 3. INTEGER year
*/
public static String findDay(int month, int day, int year) {
SimpleDateFormat simpleDateformat = new SimpleDateFormat("EEEE");
Date date = new GregorianCalendar(year, month - 1, day).getTime();
String dayText = simpleDateformat.format(date);
return dayText.toUpperCase();
}
LocalDateTime now = LocalDateTime.now();
int year = now.getYear();
int month = now.getMonthValue();
int day = now.getDayOfMonth();
int hour = now.getHour();
int minute = now.getMinute();
int second = now.getSecond();
int millis = now.get(ChronoField.MILLI_OF_SECOND); // Note: no direct getter available.
System.out.printf("%d-%02d-%02d %02d:%02d:%02d.%03d", year, month, day, hour, minute, second, millis);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date parse = sdf.parse("18/08/2012");
Calendar c = Calendar.getInstance();
c.setTime(parse);
System.out.println(c.get(Calendar.MONTH) + c.get(Calendar.DATE) + c.get(Calendar.YEAR));
Calendar cal = Calendar.getInstance();
cal.set(year,month-1,day);
int nd = cal.get(Calendar.DAY_OF_WEEK);
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE));
Date lastDayOfMonth = cal.getTime();