Example usage for java.time Month JANUARY

List of usage examples for java.time Month JANUARY

Introduction

In this page you can find the example usage for java.time Month JANUARY.

Prototype

Month JANUARY

To view the source code for java.time Month JANUARY.

Click Source Link

Document

The singleton instance for the month of January with 31 days.

Usage

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.JANUARY;
    System.out.println(m.getValue());
    System.out.println(m.name());
    System.out.println(m.ordinal());
}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.of(2013, Month.JANUARY);

    System.out.println(y);

}

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.now();
    MonthDay n = m.with(Month.JANUARY);
    System.out.println(n);

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    YearMonth l = y.atMonth(Month.JANUARY);
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate ld = LocalDate.of(2014, Month.JANUARY, 1);
    String pattern = "'New Year in'  yyyy  'is on' EEEE";
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
    String str = ld.format(formatter);
    System.out.println(str);//  w  w  w .  jav a  2  s  .  co m

}

From source file:Main.java

public static void main(String[] args) {
    Locale englishUS = Locale.US;
    LocalDateTime ldt = LocalDateTime.of(2014, Month.JANUARY, 25, 11, 48, 16);

    System.out.printf(englishUS, "US: %tB %<te,  %<tY  %<tT %<Tp%n", ldt);
}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    long s = y.until(YearMonth.of(1990, Month.JANUARY), ChronoUnit.YEARS);
    System.out.println(s);/*from   w  ww. j a v  a2s.  c  o m*/

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate ld1 = LocalDate.of(2014, Month.JANUARY, 7);
    LocalDate ld2 = LocalDate.of(2014, Month.MAY, 21);
    long days = ChronoUnit.DAYS.between(ld1, ld2);
    System.out.println(days);//from w w  w. j ava  2 s . co m

    LocalTime lt1 = LocalTime.of(6, 0);
    LocalTime lt2 = LocalTime.of(9, 30);
    long hours = ChronoUnit.HOURS.between(lt1, lt2);
    System.out.println(hours);
    long minutes = ChronoUnit.MINUTES.between(lt1, lt2);
    System.out.println(minutes);
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate ld1 = LocalDate.of(2014, Month.JANUARY, 7);
    LocalDate ld2 = LocalDate.of(2014, Month.MAY, 18);

    LocalTime lt1 = LocalTime.of(7, 0);
    LocalTime lt2 = LocalTime.of(9, 30);

    long days = ld1.until(ld2, ChronoUnit.DAYS);
    System.out.println(days);/*from  w w w  .j  a  va2  s .  c  o  m*/
    long hours = lt1.until(lt2, ChronoUnit.HOURS);
    System.out.println(hours);
    long minutes = lt1.until(lt2, ChronoUnit.MINUTES);
    System.out.println(minutes);
}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    Temporal s = y.adjustInto(YearMonth.of(1990, Month.JANUARY));
    System.out.println(s);/*from   w w w.  j a v  a  2s.c o  m*/

}