Example usage for java.time LocalDate now

List of usage examples for java.time LocalDate now

Introduction

In this page you can find the example usage for java.time LocalDate now.

Prototype

public static LocalDate now() 

Source Link

Document

Obtains the current date from the system clock in the default time-zone.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDate today = LocalDate.now();

    // Temporal adjusters for adjusting the dates
    System.out.println("First date of this month= " + today.with(TemporalAdjusters.firstDayOfMonth()));
    LocalDate lastDayOfYear = today.with(TemporalAdjusters.lastDayOfYear());
    System.out.println("Last date of this year= " + lastDayOfYear);

    Period period = today.until(lastDayOfYear);
    System.out.println("Period Format= " + period);
    System.out.println("Months remaining in the year= " + period.getMonths());

}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime d = o.with(LocalDate.now());
    System.out.println(d);// w  ww .  ja  va  2 s.com
}

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());

    System.out.println(m.getDisplayName(TextStyle.SHORT, Locale.UK));

}

From source file:Main.java

public static void main(String[] args) {
    System.out.println(fromLocalDate(LocalDate.now()));
}

From source file:Main.java

public static void main(String[] args) {
    System.out.println(toTimestamp(LocalDate.now()));
}

From source file:Main.java

public static void main(String[] argv) {
    System.out.println(isWeekend(LocalDate.now()));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate[] a = nextWeekDay(LocalDate.now());

    System.out.println(Arrays.toString(a));
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate[] a = previousWeekDay(LocalDate.now());

    System.out.println(Arrays.toString(a));
}

From source file:Main.java

public static void main(String[] argv) {
    System.out.println(getQuarter(LocalDate.now()));
}

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime z = ZonedDateTime.of(LocalDate.now(), LocalTime.now(), ZoneId.systemDefault());

    System.out.println(z);//from  ww w . j  a  va 2  s.c  om

}