commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darko Palic (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LANG-1377) DateUtils.parseDateStrictly is not working properly
Date Sun, 28 Jan 2018 14:10:00 GMT
Darko Palic created LANG-1377:
---------------------------------

             Summary: DateUtils.parseDateStrictly is not working properly
                 Key: LANG-1377
                 URL: https://issues.apache.org/jira/browse/LANG-1377
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.time.*
    Affects Versions: 3.7
            Reporter: Darko Palic


I have following example to parse dates. The parsing fails in the given cases.

{{   @Test}}
{{   public void dateFormatParseStrictTest() throws ParseException {}}
{{      String[] lMessageDateStrArray = new String[] {}}
{{            "03.05.2017 08:05:15",}}
{{            "03.05.17 09:05:15",}}
{{            "13:05:15 03.05",}}
{{            "03.05 07:05",}}
{{            "03.05 09:05:15"}}
{{      };}}

{{      String lDateFormatCommon1 = "dd.MM.yyyy hh:mm:ss";}}
{{      String lDateFormatCommon2 = "dd.MM.yy hh:mm:ss";}}
{{      // fallback formats}}
{{      String lDateFormatStrange1 = "hh:mm dd.MM";}}
{{      String lDateFormatStrange2 = "dd.MM hh:mm";}}
{{      String lDateFormatStrange3 = "dd.MM hh:mm:ss";}}

{{      for (String lMessageDateStr : lMessageDateStrArray) {}}
{{         Date lMessageDate = DateUtils.parseDateStrictly(lMessageDateStr, Locale.GERMAN,
lDateFormatCommon1, lDateFormatCommon2, lDateFormatStrange1,}}
{{               lDateFormatStrange2, lDateFormatStrange3);}}
{{      }}}

{{   }}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message