This program prints the current date and time in various time zones using the java.time package in Java. Here's how it works:
import java.time.*; class Current_Available_TimeZones { public static void main(String[] args) { ZoneId.SHORT_IDS.keySet(). stream().forEach(zoneKey ->System.out.println(" "+ ZoneId.of( ZoneId.SHORT_IDS.get( zoneKey ) ) +": "+ LocalDateTime.now(ZoneId.of(ZoneId.SHORT_IDS.get( zoneKey ) ) ) ) ); } }
Australia/Sydney: 2022-11-05T19:02:41.412034 Asia/Kolkata: 2022-11-05T13:32:41.443283500 America/Chicago: 2022-11-05T03:02:41.443283500 Asia/Yerevan: 2022-11-05T12:02:41.443283500 America/Argentina/Buenos_Aires: 2022-11-05T05:02:41.458907800 Africa/Harare: 2022-11-05T10:02:41.458907800 Pacific/Apia: 2022-11-05T22:02:41.458907800 America/Sao_Paulo: 2022-11-05T05:02:41.458907800 America/Los_Angeles: 2022-11-05T01:02:41.458907800 Africa/Cairo: 2022-11-05T10:02:41.458907800 Asia/Tokyo: 2022-11-05T17:02:41.458907800 Asia/Ho_Chi_Minh: 2022-11-05T15:02:41.458907800 America/Indiana/Indianapolis: 2022-11-05T04:02:41.458907800 America/St_Johns: 2022-11-05T05:32:41.474532 Asia/Karachi: 2022-11-05T13:02:41.474532 America/Phoenix: 2022-11-05T01:02:41.474532 -05:00: 2022-11-05T03:02:41.474532 Africa/Addis_Ababa: 2022-11-05T11:02:41.474532 Europe/Paris: 2022-11-05T09:02:41.474532 America/Puerto_Rico: 2022-11-05T04:02:41.474532 Asia/Shanghai: 2022-11-05T16:02:41.474532 Pacific/Guadalcanal: 2022-11-05T19:02:41.474532 -07:00: 2022-11-05T01:02:41.474532 America/Anchorage: 2022-11-05T00:02:41.474532 Pacific/Auckland: 2022-11-05T21:02:41.474532 -10:00: 2022-11-04T22:02:41.474532 Australia/Darwin: 2022-11-05T17:32:41.490157 Asia/Dhaka: 2022-11-05T14:02:41.490157
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions