ZonedDateTime withFixedOffsetZone() example
Description
ZonedDateTime withFixedOffsetZone()
returns a copy of this date-time with the zone ID set to the offset.
Syntax
withFixedOffsetZone
has the following syntax.
public ZonedDateTime withFixedOffsetZone()
Example
The following example shows how to use withFixedOffsetZone
.
import java.time.ZonedDateTime;
/*from www. j a v a 2 s . co m*/
public class Main {
public static void main(String[] args) {
ZonedDateTime dateTime =ZonedDateTime.now();
ZonedDateTime l =dateTime.withFixedOffsetZone() ;
System.out.println(l);
}
}
The code above generates the following result.