fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.time.OffsetDateTime;
  8. import java.time.ZoneId;
  9. import java.time.ZonedDateTime;
  10. import java.time.format.DateTimeFormatter;
  11. import java.time.format.FormatStyle;
  12. import java.util.Locale;
  13.  
  14. /* Name of the class has to be "Main" only if the class is public. */
  15. class Ideone
  16. {
  17. public static void main (String[] args) throws java.lang.Exception
  18. {
  19. System.out.println(
  20.  
  21. OffsetDateTime
  22. .parse( "2020-11-22T10:02:13.501-04:00" )
  23. .atZoneSameInstant(
  24. ZoneId.of( "America/New_York" )
  25. )
  26. .format(
  27. DateTimeFormatter
  28. .ofPattern ( "dd/MMM/uuuu HH:mm a z" )
  29. .withLocale ( Locale.US )
  30. )
  31.  
  32. );
  33. }
  34. }
Success #stdin #stdout 0.27s 51708KB
stdin
Standard input is empty
stdout
22/Nov/2020 09:02 AM EST