package govind;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
public class Java8TimeDateConcept {
public static void main(String[] args) {
LocalDate today = LocalDate.now();
System.out.println("Today Date="+today);
int year = today.getYear();
int month = today.getMonthValue();
int day = today.getDayOfMonth();
DayOfWeek dayOfweek = today.getDayOfWeek();
Month month1 = today.getMonth();
int lm = today.lengthOfMonth();
int ly = today.lengthOfYear();
System.out.println("Year="+year);
System.out.println("Month="+month);
System.out.println("Day="+day);
System.out.println( "DayOfWeek="+dayOfweek);
System.out.println("Month="+month1);
System.out.println("Length of the Month="+lm);
System.out.println("Length of the Year="+ly);
}
}
o/p:------------------------------------------------------------------
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
public class Java8TimeDateConcept {
public static void main(String[] args) {
LocalDate today = LocalDate.now();
System.out.println("Today Date="+today);
int year = today.getYear();
int month = today.getMonthValue();
int day = today.getDayOfMonth();
DayOfWeek dayOfweek = today.getDayOfWeek();
Month month1 = today.getMonth();
int lm = today.lengthOfMonth();
int ly = today.lengthOfYear();
System.out.println("Year="+year);
System.out.println("Month="+month);
System.out.println("Day="+day);
System.out.println( "DayOfWeek="+dayOfweek);
System.out.println("Month="+month1);
System.out.println("Length of the Month="+lm);
System.out.println("Length of the Year="+ly);
}
}
o/p:------------------------------------------------------------------
No comments:
Post a Comment