Package 

Interface DateFormatter


  • 
    public interface DateFormatter
    
                        

    An interface that allows to format date-time objects as strings.

    • Method Summary

      Modifier and Type Method Description
      abstract String formatDate(Date date) Formats the given date as a String.
      abstract String formatTime(Date date) Formats the given time as a String.
      abstract String formatRelativeTime(Date date) Formats the given date as a relative time string.
      abstract String formatRelativeDate(Date date) Returns a relative date string for the given date.
      • Methods inherited from class java.lang.Object

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

      • formatDate

         abstract String formatDate(Date date)

        Formats the given date as a String. A normal implementation of this method would return a string like "Yesterday", "Saturday", "9:25 AM"/"9:25", ... It is used to format the date of the last message in the channel list and the when an user voted in a poll.

        Parameters:
        date - The Date to format as a String.
      • formatTime

         abstract String formatTime(Date date)

        Formats the given time as a String. A normal implementation of this method would return a string like "9:25 AM"/"9:25". It is used to format the time of the message in the message list.

        Parameters:
        date - The Date object to format as a String.
      • formatRelativeTime

         abstract String formatRelativeTime(Date date)

        Formats the given date as a relative time string. A normal implementation of this method would return a string like "Just now", "5 minutes ago", ... It is used to format the time when a message was edited in the message list.

        Parameters:
        date - The Date to format as a relative time string.
      • formatRelativeDate

         abstract String formatRelativeDate(Date date)

        Returns a relative date string for the given date. A normal implementation of this method would return a string like "Yesterday", "A day ago", ... It is used to format the date of the separator in the message list.

        Parameters:
        date - The Date to format as a relative date string.