OffsetDateTime now(ZoneId zone) example
Description
OffsetDateTime now(ZoneId zone)
creates
the current date-time from the system clock in the specified time-zone.
Syntax
now
has the following syntax.
public static OffsetDateTime now(ZoneId zone)
Example
The following example shows how to use now
.
import java.time.OffsetDateTime;
import java.time.ZoneId;
//from www . j a v a2 s. c om
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.now(ZoneId.systemDefault());
System.out.println(o);
}
}
The code above generates the following result.