Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8239603

PHT timezone not recognized post JDK 8u191

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 8
    • core-libs

      import java.util.*;
      import java.text.*;
      import java.text.ParseException;

      public class MyClass {
          public static void main(String args[]) {
            try{
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm z");
                      sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
                      Date date = sdf.parse("2020-03-04 03:02 PHT");
          
          }catch (Exception pe){
            System.out.println("error is" + pe.getMessage());
          }
              System.out.println("Program execution successful");
          }
      }

      causes :

      The unparsed string is: 2020-03-04 03:02 PHT
      java.text.ParseException: Unparseable date: "2020-03-04 03:02 PHT"
      at java.text.DateFormat.parse(DateFormat.java:366)

            kravikumar Kiran Sidhartha Ravikumar (Inactive)
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: