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

While converting String "1900-01-01 05:45:00.000" to date if gives date 1900-01-01 06:08:20.000

XMLWordPrintable

    • x86_64
    • windows_vista

      ADDITIONAL SYSTEM INFORMATION :
      windows 7 64 bit

      A DESCRIPTION OF THE PROBLEM :
      while converting String "1900-01-01 05:45:00.000" to date it gives date "1900-01-01 06:08:20.000"

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      while converting String "1900-01-01 05:45:00.000" to date it gives date "1900-01-01 06:08:20.000"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      "1900-01-01 05:45:00.000"
      ACTUAL -
      "1900-01-01 06:08:20.000"

      ---------- BEGIN SOURCE ----------
      public class Test {

      public static void main(String[] args){
      try {
      String defaultDate = "1900-01-01 05:51:00.000";
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
      Date date = sdf.parse(defaultDate);

      DateUtils.parseDate(defaultDate, new String[]{"yyyy-MM-dd hh:mm:ss.SSS"});
      System.out.println(date);
      }catch(Exception e) {
      e.printStackTrace();
      }
      }

      }

      ---------- END SOURCE ----------

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: