import java.util.*;
import java.lang.*;
import java.io.*;
import java.time.*;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
// Change the JVM Time Zone with the parameter 'user.timezone' as run argument -Duser.timezone=America/Buenos_Aires.
// https://[Log in to view URL]
class Main {
public static void main(String[] args) {
System.setProperty("user.timezone", "America/Buenos_Aires"); // UTC−03:00
Date now = new Date();
String format = "yyyy-MM-dd HH:mm:ss";
System.out.println(String.format("Date with zone %s: %s", System.getProperty("user.timezone"), new SimpleDateFormat(format).format(now)));
ZonedDateTime nowInSystemZoneId = now.toInstant().atZone(ZoneId.systemDefault());
System.out.println("ZonedDateTime with System default ZoneId: " + nowInSystemZoneId.format(DateTimeFormatter.ofPattern(format)));
ZonedDateTime nowInGuayaquil = now.toInstant().atZone(ZoneId.of("America/Guayaquil"));
System.out.println("ZonedDateTime with America/Guayaquil ZoneId: " + nowInGuayaquil.format(DateTimeFormatter.ofPattern(format)));
ZonedDateTime nowInUtc = now.toInstant().atZone(ZoneId.of("UTC"));
System.out.println("ZonedDateTime with UTC ZoneId: " + nowInUtc.format(DateTimeFormatter.ofPattern(format)));
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: