Class DateLibrary


  • public class DateLibrary
    extends Object
    Contains a number of convenience methods for Date manipulation
    Author:
    bdferris
    • Constructor Detail

      • DateLibrary

        public DateLibrary()
    • Method Detail

      • getTimeAsIso8601String

        public static String getTimeAsIso8601String​(Date date)
        Parameters:
        date - a target Date object
        Returns:
        an ISO 8601 string representation of a Date
      • getTimeAsIso8601String

        public static String getTimeAsIso8601String​(Date date,
                                                    TimeZone timeZone)
        Parameters:
        date - a target Date object
        timeZone - the target timezone for the ISO 8601 representation
        Returns:
        an ISO 8601 string representation of a Date
      • getIso8601StringAsTime

        public static Date getIso8601StringAsTime​(String value)
                                           throws ParseException
        Parameters:
        value - an ISO 8601 string representation fo a Date
        Returns:
        a parsed Date object
        Throws:
        ParseException - if there is an error parsing the string
      • getIso8601StringAsTime

        public static Date getIso8601StringAsTime​(String value,
                                                  TimeZone timeZone)
                                           throws ParseException
        Parameters:
        value - an ISO 8601 string representation fo a Date
        timeZone - the target timezone for the ISO 8601 representation
        Returns:
        a parsed Date object
        Throws:
        ParseException - if there is an error parsing the string
      • getTimeAsDay

        public static Date getTimeAsDay​(Date t)
      • getTimeAsDay

        public static Date getTimeAsDay​(long t)
      • hasAmPmClock

        public static boolean hasAmPmClock​(Locale locale)