We would like to know how to create date time in system default timezone.
import java.time.ZoneId; import java.time.ZonedDateTime; /*from w w w .j a v a 2s .c om*/ public class Main { public static void main(String[] args) { ZonedDateTime myZonedDateTime = ZonedDateTime.of(2014, 1, 31, 11, 20, 30, 93020122, ZoneId.systemDefault()); System.out.println(myZonedDateTime); } }
The code above generates the following result.