Example usage for java.time LocalDateTime now

List of usage examples for java.time LocalDateTime now

Introduction

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

Prototype

public static LocalDateTime now() 

Source Link

Document

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

Usage

From source file:Main.java

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

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

From source file:Main.java

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

    System.out.println(a.equals(LocalDateTime.now()));
}

From source file:Main.java

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

    System.out.println(a.hashCode());
}

From source file:Main.java

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

    System.out.println(a.isEqual(LocalDateTime.now()));
}

From source file:Main.java

public static void main(String[] args) {

    LocalDateTime timePoint = LocalDateTime.now();
    LocalDateTime thePast = timePoint.withDayOfMonth(10).withYear(2010);

    System.out.println(thePast);//w  ww .j  a v  a2  s .  c om
}

From source file:Main.java

public static void main(String[] argv) {

    LocalDate d = LocalDateTime.now().toLocalDate();
    System.out.println(d);
}

From source file:Main.java

public static void main(String[] args) {
    LocalTime l = LocalTime.from(LocalDateTime.now());

    System.out.println(l);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

    // Get the date time 10 days ago
    LocalDateTime localDateTime1 = now.minus(10, ChronoUnit.DAYS);
    System.out.println(localDateTime1);

}