Created
March 20, 2020 03:09
-
-
Save bmnepali/84cb123d6fa6f0218fbd7153e9f6d2a8 to your computer and use it in GitHub Desktop.
Revisions
-
bmnepali created this gist
Mar 20, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ import java.time.LocalTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; public class HelloWorld{ public static void main(String []args){ System.out.println("Hello World"); LocalTime time = LocalTime.parse("10:00:00"); // 10 AM ZonedDateTime utc = ZonedDateTime .now(ZoneId.of("Asia/Calcutta")) // current date/time in India .with(time) // set time to 10 AM .withZoneSameInstant(ZoneOffset.UTC); // convert to UT System.out.println("Time in UTC: " + utc); } }