Java Date Time - LocalTime now(ZoneId zone) example








LocalTime now(ZoneId zone) gets the current time from the system clock in the specified time-zone.

Syntax

now has the following syntax.

public static LocalTime now(ZoneId zone)

Example

The following example shows how to use now.

import java.time.LocalTime;
import java.time.ZoneId;
/*from w ww.  ja va2s . c o  m*/
public class Main {
  public static void main(String[] args) {
    LocalTime l = LocalTime.now(ZoneId.systemDefault());
    
    System.out.println(l);
  }
}

The code above generates the following result.