You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Darko Palic (JIRA)" <ji...@apache.org> on 2018/01/28 14:10:00 UTC

[jira] [Created] (LANG-1377) DateUtils.parseDateStrictly is not working properly

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)