fork download
  1. import java.time.ZonedDateTime;
  2. import java.time.format.DateTimeFormatter;
  3. import java.util.Locale;
  4.  
  5. class Main {
  6. public static void main(String[] args) {
  7. DateTimeFormatter parser = DateTimeFormatter.ofPattern("H:m:s MMM d, uuuu z", Locale.ENGLISH);
  8. String strNextPaymentDate = "02:00:00 Feb 05, 2023 PST";
  9. ZonedDateTime zdtNextPaymentDate = ZonedDateTime.parse(strNextPaymentDate, parser);
  10. ZonedDateTime zdtExpectedDate = ZonedDateTime.of(2023, 2, 5, 2, 0, 0, 0, zdtNextPaymentDate.getZone());
  11. System.out.println(zdtNextPaymentDate);
  12. System.out.println(zdtExpectedDate);
  13. }
  14. }
Success #stdin #stdout 0.36s 60940KB
stdin
Standard input is empty
stdout
2023-02-05T02:00-08:00[America/Los_Angeles]
2023-02-05T02:00-08:00[America/Los_Angeles]