Close

Java Date Time - Clock.fixed() Examples

Java Date Time Java Java API 


Class:

java.time.Clock

java.lang.Objectjava.lang.Objectjava.time.Clockjava.time.ClockLogicBig

Method:

public static Clock fixed(Instant fixedInstant,
                          ZoneId zone)

Obtains a clock created from specified fixed instant.


Examples


package com.logicbig.example.clock;

import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;

public class FixedExample {

public static void main(String... args) {

Clock c = Clock.fixed(Instant.parse("2017-01-03T10:15:30.00Z"),
ZoneId.of("Asia/Bangkok"));
System.out.println(c);
}
}

Output

FixedClock[2017-01-03T10:15:30Z,Asia/Bangkok]




See Also