Last active
October 2, 2018 12:07
-
-
Save kpradeep12/f6bf2f33381e5741fa09a5509c2893a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.util.stream.Stream; | |
public class WorldClock { | |
public static void main(String[] args) { | |
DateTimeFormatter FORMAT = DateTimeFormatter.ofPattern("E, dd MMM u hh:mm:ss a z"); | |
Stream.of(args) | |
.map(ZoneId.SHORT_IDS::get) | |
.map(ZoneId::of) | |
.map(ZonedDateTime::now) | |
.map(time -> time.format(FORMAT)) | |
.forEach(System.out::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment