LocalDateTime now(ZoneId zone)
gets the current date-time from
the system clock in the specified time-zone.
now
has the following syntax.
public static LocalDateTime now(ZoneId zone)
The following example shows how to use now
.
import java.time.LocalDateTime; import java.time.ZoneId; /*www.ja va2 s. c om*/ public class Main { public static void main(String[] args) { LocalDateTime a = LocalDateTime.now(ZoneId.systemDefault()); System.out.println(a); } }
The code above generates the following result.