We would like to know how to get current time in UTC time zone.
import java.time.Clock; import java.time.LocalTime; /* w w w. jav a 2 s .c o m*/ public class Main { public static void main(String[] args) { LocalTime nowInUtc = LocalTime.now(Clock.systemUTC()); System.out.println(nowInUtc); // 06:08:18.125 } }
The code above generates the following result.