Class TimeDateFormatter

  • All Implemented Interfaces:
    Serializable

    public class TimeDateFormatter
    extends Object
    implements Serializable
    Class to help in formatting of time and date strings. Allows callers to set the current date/time format.
    Version:
    1.0
    Author:
    Mike Douglass douglm@rpi.edu
    See Also:
    Serialized Form
    • Constructor Detail

      • TimeDateFormatter

        public TimeDateFormatter()
      • TimeDateFormatter

        public TimeDateFormatter​(int style)
        Parameters:
        style - key
      • TimeDateFormatter

        public TimeDateFormatter​(int style,
                                 Locale l)
        Parameters:
        style - key
        l - locale
      • TimeDateFormatter

        public TimeDateFormatter​(String pattern)
        Parameters:
        pattern - for time/date
      • TimeDateFormatter

        public TimeDateFormatter​(String pattern,
                                 Locale l)
        Parameters:
        pattern - for time/date
        l - locale
    • Method Detail

      • format

        public String format​(Date val)
        Return a text representation of the Date object
        Parameters:
        val - Date
        Returns:
        text representation of the Date object
      • parse

        public Date parse​(String val)
                   throws Exception
        Parameters:
        val - pattern for time/date
        Returns:
        parsed parameter
        Throws:
        Exception
      • setStyle

        public void setStyle​(int style)
        Parameters:
        style - set to default locale
      • setStylePattern

        public void setStylePattern​(int style,
                                    String pattern)
        Parameters:
        style - key
        pattern - the pattern
      • setPattern

        public void setPattern​(String pattern)
        Parameters:
        pattern - for time/date