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

Add clearTime() to java.util.Date and/or java.util.Calendar

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.6
    • 1.6.8, 1.7.1, 1.8-beta-1
    • groovy-jdk
    • None
    • Patch

    Description

      It'd be nice to have a convenience method that clears the time portion of a java.util.Date and/or java.util.Calendar. There are numerous use cases where it makes sense to compare month/day/year only portions of a calendar or date. Essentially, it would perform the following on Calendar:

      void clearTime() {
              clear(Calendar.HOUR_OF_DAY)
              clear(Calendar.HOUR)
              clear(Calendar.MINUTE)
              clear(Calendar.SECOND)
              clear(Calendar.MILLISECOND) 
      }
      

      Similar functionality would be nice on Date.

      Attachments

        1. patchfile.txt
          2 kB
          Rodolfo Velasco

        Activity

          People

            guillaume Guillaume Sauthier
            dhreines David Reines
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: