Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1354

JSON date parsing fails with timezones other than Z

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.12.3
    • Component/s: JSON
    • None
    • Environment:
      Windows
    • Fully Compatible

      When the parser encounters a field with e.g.

      { "$date" : "2013-12-03T10:41:22.393+0200" }

      the resulting value is null.

      The reason is that the format string given to SimpleDateFormat is "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" which requires a literal 'Z' rather than actually parsing the timezone.

      Changing the string to "yyyy-MM-dd'T'HH:mm:ss.SSSX" should work better.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            fbjon Frej Bjon
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: