OffsetTime truncatedTo(TemporalUnit unit)
returns a copy of this OffsetTime with the time truncated.
truncatedTo
has the following syntax.
public OffsetTime truncatedTo(TemporalUnit unit)
The following example shows how to use truncatedTo
.
import java.time.OffsetTime; import java.time.temporal.ChronoUnit; //from w w w . j a v a 2 s . c o 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.