OffsetTime truncatedTo(TemporalUnit unit) example
Description
OffsetTime truncatedTo(TemporalUnit unit)
returns a copy of this OffsetTime with the time truncated.
Syntax
truncatedTo
has the following syntax.
public OffsetTime truncatedTo(TemporalUnit unit)
Example
The following example shows how to use truncatedTo
.
import java.time.OffsetTime;
import java.time.temporal.ChronoUnit;
//from www. ja v a2s . co m
public class Main {
public static void main(String[] args) {
OffsetTime m = OffsetTime.now();
OffsetTime n = m.truncatedTo(ChronoUnit.DAYS);
System.out.println(n);
}
}
The code above generates the following result.