fork download
  1. import java.time.ZoneId;
  2. import java.time.ZonedDateTime;
  3. import java.time.format.DateTimeFormatter;
  4. import java.util.Locale;
  5.  
  6. public class Main {
  7. public static void main(String[] args) {
  8. // Test
  9. System.out.println(getDateCreatedFormatted());
  10. }
  11.  
  12. public static String getDateCreatedFormatted() {
  13. ZonedDateTime now = ZonedDateTime.now(ZoneId.of("America/New_York"));
  14. DateTimeFormatter dtf = DateTimeFormatter.ofPattern("EEE MMM d uuuu h:mm:ss a z", Locale.ENGLISH);
  15. return dtf.format(now);
  16. }
  17. }
Success #stdin #stdout 0.23s 58464KB
stdin
Standard input is empty
stdout
Fri Jul 30 2021 10:10:15 AM EDT