Java Reference
In-Depth Information
System.out.println("Day Of Week: " + dayWeek);
System.out.println("Day of Year: " + dayOfYr);
// Obtain year
int year = ldt.getYear();
System.out.println("Date: " + monthValue + "/" + day
+ "/" + year);
int hour = ldt.getHour();
int minute = ldt.getMinute();
int second = ldt.getSecond();
System.out.println("Current Time: " + hour + ":" + minute
+ ":" + second);
// Calculation of Months, etc.
LocalDateTime currMinusMonths = ldt.minusMonths(12);
LocalDateTime currMinusHours = ldt.minusHours(10);
LocalDateTime currPlusDays = ldt.plusDays(30);
System.out.println("Current Date and Time Minus 12
Months: " + currMinusMonths);
System.out.println("Current Date and Time MInus 10 Hours:
" + currMinusHours);
System.out.println("Current Date and Time Plus 30 Days:"
+ currPlusDays);
Here's the result:
Day: 18
Day Of Week: WEDNESDAY
Day of Year: 352
Date: 12/18/2013
Current Time: 23:8:41
Current Date and Time Minus 12 Months:
2012-12-18T23:41:34.084
Current Date and Time MInus 10 Hours:
2014-12-18T13:41:34.084
Current Date and Time Plus 30 Days:2014-01-17T23:41:34.084
Search WWH ::




Custom Search