List of usage examples for java.time.format DateTimeFormatter ofPattern
public static DateTimeFormatter ofPattern(String pattern)
From source file:Main.java
public static void main(String[] args) { Year y = Year.parse("2014", DateTimeFormatter.ofPattern("yyyy")); System.out.println(y);//ww w.j av a 2s. c o m }
From source file:Main.java
public static void main(String[] args) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("M/d/y"); LocalDate maxCloseDate = LocalDate.parse("02/06/2015", formatter); System.out.println(maxCloseDate); }
From source file:Main.java
public static void main(String[] argv) { DateTimeFormatter format = DateTimeFormatter.ofPattern("MMM dd yyyy hh:mm a z"); ZonedDateTime arrivalDate = ZonedDateTime.now(); String landing = arrivalDate.format(format); System.out.printf("Arriving at : %s %n", landing); }
From source file:Main.java
public static void main(String[] args) { MonthDay m = MonthDay.parse("10 10", DateTimeFormatter.ofPattern("M dd")); System.out.println(m);//from w w w .ja va 2 s . com }
From source file:Main.java
public static void main(String[] args) { DateTimeFormatter obscurePattern = DateTimeFormatter.ofPattern("MMMM dd, yyyy '(In Time Zone: 'VV')'"); ZonedDateTime zonedNow = ZonedDateTime.now(); System.out.println(obscurePattern.format(zonedNow)); }
From source file:Main.java
public static void main(String[] args) { DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); LocalDateTime now = LocalDateTime.now(); LocalDateTime then = now.minusDays(7); System.out.println(String.format("Now: %s\nThen: %s", now.format(format), then.format(format))); }
From source file:Main.java
public static void main(String[] args) { YearMonth y = YearMonth.parse("2013 09", DateTimeFormatter.ofPattern("yyyy MM")); System.out.println(y);//from w ww.jav a2 s. co m }
From source file:Main.java
public static void main(String[] args) { Year y = Year.of(2014); String l = y.format(DateTimeFormatter.ofPattern("yyyy")); System.out.println(l);// w w w .ja va 2 s . c o m }
From source file:Main.java
public static void main(String[] args) { MonthDay m = MonthDay.now(); String n = m.format(DateTimeFormatter.ofPattern("M")); System.out.println(n);//from w w w. j a v a2 s . com }
From source file:Main.java
public static void main(String[] args) { YearMonth y = YearMonth.now(); String s = y.format(DateTimeFormatter.ofPattern("yyyy MM")); System.out.println(s);/*ww w . j a v a2s. c o m*/ }