Class DateUtilities


  • public class DateUtilities
    extends java.lang.Object

    Various static methods helpful for handling dates.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getAgeBetweenAsDICOMAgeString​(java.lang.String earlierDate, java.lang.String laterDate)
      Get a DICOM Age String (AS) VR form age between two dates.
      static java.lang.String getAgeBetweenAsDICOMAgeString​(java.util.Calendar earlierDate, java.util.Calendar laterDate)
      Get a DICOM Age String (AS) VR form age between two dates.
      static java.lang.String getAgeBetweenAsDICOMAgeString​(java.util.Date earlierDate, java.util.Date laterDate)
      Get a DICOM Age String (AS) VR form age between two dates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • yyyymmddFormat

        public static java.text.SimpleDateFormat yyyymmddFormat
      • threeDigitZeroPaddedFormat

        public static java.text.DecimalFormat threeDigitZeroPaddedFormat
    • Method Detail

      • getAgeBetweenAsDICOMAgeString

        public static java.lang.String getAgeBetweenAsDICOMAgeString​(java.lang.String earlierDate,
                                                                     java.lang.String laterDate)
                                                              throws java.text.ParseException,
                                                                     java.lang.IllegalArgumentException

        Get a DICOM Age String (AS) VR form age between two dates.

        Uses UK (not US) convention for leap year birthdays (earlierDate).

        Parameters:
        earlierDate - for example, the date of birth
        laterDate - for example, the current date
        Throws:
        java.text.ParseException - if one of the dates is not in the correct form
        java.lang.IllegalArgumentException - if the later date is earlier than the earlier date
      • getAgeBetweenAsDICOMAgeString

        public static java.lang.String getAgeBetweenAsDICOMAgeString​(java.util.Date earlierDate,
                                                                     java.util.Date laterDate)
                                                              throws java.lang.IllegalArgumentException

        Get a DICOM Age String (AS) VR form age between two dates.

        Uses UK (not US) convention for leap year birthdays (earlierDate).

        Parameters:
        earlierDate - for example, the date of birth
        laterDate - for example, the current date
        Throws:
        java.lang.IllegalArgumentException - if the later date is earlier than the earlier date
      • getAgeBetweenAsDICOMAgeString

        public static java.lang.String getAgeBetweenAsDICOMAgeString​(java.util.Calendar earlierDate,
                                                                     java.util.Calendar laterDate)
                                                              throws java.lang.IllegalArgumentException

        Get a DICOM Age String (AS) VR form age between two dates.

        Uses UK (not US) convention for leap year birthdays (earlierDate).

        Parameters:
        earlierDate - for example, the date of birth
        laterDate - for example, the current date
        Throws:
        java.lang.IllegalArgumentException - if the later date is earlier than the earlier date