Class DateUtils

    • Method Detail

      • formatWithAge

        public static String formatWithAge​(Date date,
                                           String suffix)
        Provided a date you will get a timestamp and the age/old that you want
        Parameters:
        date - the date to compare to now.
        suffix - the suffix in the age string. using "ago" here would result in "2006 Aug 23, 11:43 pm - 12 days ago"
        Returns:
        the formated string.
      • formatWithAge

        public static String formatWithAge​(Date date,
                                           String dateFormat,
                                           String suffix)
        Provided a date you will get a timestamp and the age/old that you want.
        Parameters:
        date - the date to compare to now.
        dateFormat - the SimpleDateFormat format string to use for the date.
        suffix - the suffix in the age string. using "ago" here would result in "2006 Aug 23, 11:43 pm - 12 days ago"
        Returns:
        the formated string.