bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/87590] New: SimpleDateFormat parse returns incorrect date


From: guillerodriguez.dev at gmail dot com
Subject: [Bug classpath/87590] New: SimpleDateFormat parse returns incorrect date if weekday is parsed
Date: Thu, 11 Oct 2018 15:21:11 +0000

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87590

            Bug ID: 87590
           Summary: SimpleDateFormat parse returns incorrect date if
                    weekday is parsed
           Product: classpath
           Version: 0.99
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guillerodriguez.dev at gmail dot com
  Target Milestone: ---

SimpleDateFormat seems to have trouble when the weekday is included in the
format string. See this:

===
import java.text.SimpleDateFormat;
import java.util.Locale;

public class DateTest
{
        public static void main(String args[]) throws Exception
        {
            String now = "2010/10/27 10:00:00 Wed";

            SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss
EEE", Locale.US);
            System.out.println(df.parse(now));

            df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);
            System.out.println(df.parse(now));
        }
}
===

which outputs:

Wed Sep 29 10:00:00 CEST 2010
Wed Oct 27 10:00:00 CEST 2010

The first one is wrong, the second one is right.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]