You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michael Osipov (JIRA)" <ji...@apache.org> on 2018/11/18 09:29:00 UTC

[jira] [Commented] (LANG-1425) DateUtils.parseDateStrictly() is not parsing millisecond value

    [ https://issues.apache.org/jira/browse/LANG-1425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16690846#comment-16690846 ] 

Michael Osipov commented on LANG-1425:
--------------------------------------

There are several issues here:

# How close is our parsing pattern to {{SimpleDateFormat}}? Not properly documented
# {{Date}} is millisecond precision: {{SSSSSSS}} cannot and will not work.
# {{S}} alreay implies upto three decimal places while parsing, during formatting it shall add trailing null at most, as far as I remember.

I guess we need to improve docs and tests. I stumbled upon this some time ago too.

Also look here: https://stackoverflow.com/a/19223267/696632

> DateUtils.parseDateStrictly() is not parsing millisecond value
> --------------------------------------------------------------
>
>                 Key: LANG-1425
>                 URL: https://issues.apache.org/jira/browse/LANG-1425
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.7
>            Reporter: Vamsi Krishna Bhagi
>            Priority: Major
>
> We need to parse String to java.util.Date and are having multiple Date formats.
> Snippet for this is 
> {code:java}
> java.util.Date dt = DateUtils.parseDateStrictly(verificationDate.get_value(),
>                                     Locale.ENGLISH,
>                                     new String[] { "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSXXX","yyyy-MM-dd'T'HH:mm::ss.SSSSSSS" });{code}
> 2018-11-13T08:03:41.2860000-06:00 is not being parsed correctly. On troubleshooting, we discovered that 2018-11-13T08:03:41.0000286-06:00 is parsing fine.
> How to handle this?
>  



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