Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在java中使用Instant类了解特定的位置时间而不是默认时区_Java - Fatal编程技术网

在java中使用Instant类了解特定的位置时间而不是默认时区

在java中使用Instant类了解特定的位置时间而不是默认时区,java,Java,我正在开发一个应用程序,在这个应用程序中,我需要知道不同位置的时间 for (String s : zoneList) { ZoneId zone = ZoneId.of(s); ZonedDateTime zdt = dt.atZone(zone); ZoneOffset offset = zdt.getOffset(); 另一种方法是使用Instant类。使用Instant类只会给我格林威治时间,但我也想知道其他位置的时间。我怎样才能像like Zone那样做到这一点。我在互联

我正在开发一个应用程序,在这个应用程序中,我需要知道不同位置的时间

for (String s : zoneList) {
  ZoneId zone = ZoneId.of(s);
  ZonedDateTime zdt = dt.atZone(zone);
  ZoneOffset offset = zdt.getOffset();

另一种方法是使用Instant类。使用Instant类只会给我格林威治时间,但我也想知道其他位置的时间。我怎样才能像like Zone那样做到这一点。我在互联网上冲浪过很多次。在这方面有人能帮我吗。我只想使用Instant。嗯,Instant没有任何时区。所以,如果目标是知道某个特定时区的时间,那么瞬间就不是你想要的。ZoneDateTime是你所需要的:它基本上是一个即时+时区。非常感谢我以前使用过zonedate time,但我想知道即时课程中是否有任何方法可以找到不同的时区,这让我花了1-2个小时在web上,无论如何谢谢你花时间留下评论。