OffsetDateTime now(ZoneId zone)
creates
the current date-time from the system clock in the specified time-zone.
now
has the following syntax.
public static OffsetDateTime now(ZoneId zone)
The following example shows how to use now
.
import java.time.OffsetDateTime; import java.time.ZoneId; // w w w . j a v a 2 s .com 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.