Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4789

Add method on Date to parse strings created with date.toString()

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7.10
    • 1.8.4, 2.0-beta-1
    • groovy-jdk
    • None

    Description

      People often need to re-parse Dates out of strings created from date.toString().

      My particular system's default date.toString() format is "Thu Apr 20 00:27:00 CEST 2006" so I know I can turn a Date into a string and then back into an object using Date.parse('EEE MMM dd HH:mm:ss z yyyy', new Date().toString()).

      But breaks when date.toString() changes format, either in a future version of Groovy or when the code moves to another system where date.toString() produces a different format (I'm not clear if this can happen or not).

      Attachments

        1. groovy_4789.patch
          3 kB
          Dirk Weber

        Activity

          People

            melix Cédric Champeau
            deanmoses Dean Moses
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: