List of usage examples for java.time Month JUNE
Month JUNE
To view the source code for java.time Month JUNE.
Click Source Link
From source file:Main.java
public static void main(String[] args) { LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21); DayOfWeek dayOfWeek = DayOfWeek.from(localDate); System.out.println(dayOfWeek.getLong(ChronoField.DAY_OF_WEEK)); }
From source file:Main.java
public static void main(String[] args) { LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21); DayOfWeek dayOfWeek = DayOfWeek.from(localDate); Temporal i = dayOfWeek.adjustInto(LocalDate.of(2014, Month.MAY, 22)); System.out.println(i);//from w w w . j a va 2 s. com }
From source file:Main.java
public static void main(String[] args) { LocalDateTime ldt = LocalDateTime.of(2014, Month.JUNE, 21, 16, 30); ZoneId usCentral = ZoneId.of("America/Chicago"); ZonedDateTime zdt = ZonedDateTime.of(ldt, usCentral); System.out.println("In US Central Time Zone:" + zdt); ZoneId losAngeles = ZoneId.of("America/Los_Angeles"); ZonedDateTime zdt2 = zdt.withZoneSameInstant(losAngeles); System.out.println("In America/Los_Angeles Time Zone:" + zdt2); }
From source file:Main.java
public static void main(String[] args) { LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21); DayOfWeek dayOfWeek = DayOfWeek.from(localDate); System.out.println(dayOfWeek.getDisplayName(TextStyle.FULL, Locale.CANADA)); System.out.println(dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.CANADA)); System.out.println(dayOfWeek.getDisplayName(TextStyle.NARROW, Locale.CANADA)); }
From source file:Main.java
public static void main(String[] args) { LocalDate ld = LocalDate.of(2014, Month.JUNE, 30); format(ld, "M/d/yyyy"); format(ld, "MM/dd/yyyy"); format(ld, "MMM dd, yyyy"); format(ld, "MMMM dd, yyyy"); format(ld, "EEEE, MMMM dd, yyyy"); format(ld, "'Month' q 'in' QQQ"); }
From source file:Main.java
public static void main(String[] args) { LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21); DayOfWeek dayOfWeek = DayOfWeek.from(localDate); TemporalQuery<TemporalUnit> localDateQuery = TemporalQueries.precision(); System.out.println(dayOfWeek.query(localDateQuery)); }
From source file:Main.java
public static void main(String[] args) { // Get the current local date LocalDate localDate1 = LocalDate.now(); System.out.println(localDate1); // Create a local date LocalDate localDate2 = LocalDate.of(2014, Month.JUNE, 21); System.out.println(localDate2); // 10000 days after the epoch date 1970-01-01 LocalDate localDate3 = LocalDate.ofEpochDay(10000); System.out.println(localDate3); }
From source file:Main.java
public static void main(String[] args) { LocalDate ld = LocalDate.of(2014, Month.JUNE, 21); LocalTime lt = LocalTime.of(17, 30, 20); LocalDateTime ldt = LocalDateTime.of(ld, lt); DateTimeFormatter fmt = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT); System.out.println("Formatter Default Locale: " + fmt.getLocale()); System.out.println("Short Date: " + fmt.format(ld)); fmt = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM); System.out.println("Medium Date: " + fmt.format(ld)); fmt = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG); System.out.println("Long Date: " + fmt.format(ld)); fmt = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL); System.out.println("Full Date: " + fmt.format(ld)); fmt = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT); System.out.println("Short Time: " + fmt.format(lt)); fmt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT); System.out.println("Short Datetime: " + fmt.format(ldt)); fmt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM); System.out.println("Medium Datetime: " + fmt.format(ldt)); // Use German locale to format the datetime in medius style fmt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.GERMAN); System.out.println(fmt.format(ldt)); // Use Indian(English) locale to format datetime in short style fmt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withLocale(new Locale("en", "IN")); System.out.println(fmt.format(ldt)); // Use Indian(English) locale to format datetime in medium style fmt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(new Locale("en", "IN")); System.out.println(fmt.format(ldt)); }
From source file:Main.java
public static void main(String[] args) { // current /*from w ww . ja v a 2 s .c om*/ LocalDateTime localDateTime1 = LocalDateTime.now(); System.out.println(localDateTime1); // 2014-06-21T16:12:34 LocalDateTime localDateTime2 = LocalDateTime.of(2014, Month.JUNE, 21, 16, 12, 34); System.out.println(localDateTime2); // from a local date and a local time LocalDate localDate1 = LocalDate.of(2014, 5, 10); LocalTime localTime = LocalTime.of(16, 18, 41); LocalDateTime localDateTime3 = LocalDateTime.of(localDate1, localTime); System.out.println(localDateTime3); }
From source file:Main.java
public static List<Employee> persons() { Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343); Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100); Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455); Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800); Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234); Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211); List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6); return persons; }