DateU
com.mhuss.Util

Class DateU



  • public class DateUextends Object
    A simple set of date and time formatters. This once trivial task got a bit complicated after the addition of i18n support.
    • Constructor Summary

      Constructors 
      Constructor and Description
      DateU() 
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      static Stringdate(Date d)
      Convert a Date into a date String using the default Locale and the DateFormat.MEDIUM size.
      static Stringdate(Date d, int dateFmt)
      Convert a Date into a date String using the default Locale.
      static StringdateNow()
      Return 'now' as a date String using the default Locale and the DateFormat.MEDIUM size.
      static StringdateNow(int dateFmt)
      Return 'now' as a date String using the default Locale
      static StringdateTime(Calendar c)
      Convert a Calendar into a date and time String using the default Locale and the DateFormat.MEDIUM size.
      static StringdateTime(Date d)
      Convert a Date into a date and time String using the default Locale and the DateFormat.MEDIUM size.
      static StringdateTime(Date d, int dtFmt)
      Convert a Date into a date and time String using the default Locale
      static StringdateTimeNow()
      Return 'now' as a date and time String using the default Locale and the DateFormat.MEDIUM size.
      static Stringtime(Date d)
      Convert a Date into a time String using the default Locale and the DateFormat.MEDIUM size.
      static Stringtime(Date d, int dateFmt)
      Convert a Date into a time String using the default Locale
    • Constructor Detail

      • DateU

        public DateU()
    • Method Detail

      • dateNow

        public static String dateNow(int dateFmt)
        Return 'now' as a date String using the default Locale
        Parameters:
        dateFmt - The java.text.DateFormat constant to use (FULL, LONG, MEDIUM, or SHORT).
        Returns:
        The current, formatted, date as a String
      • dateNow

        public static String dateNow()
        Return 'now' as a date String using the default Locale and the DateFormat.MEDIUM size.
        Returns:
        The current formatted date as a String
      • dateTimeNow

        public static String dateTimeNow()
        Return 'now' as a date and time String using the default Locale and the DateFormat.MEDIUM size.
        Returns:
        The current, formatted, date and time as a String
      • date

        public static String date(Date d,          int dateFmt)
        Convert a Date into a date String using the default Locale.
        Parameters:
        d - The java.util.Date to convert
        dateFmt - The java.text.DateFormat constant to use (FULL, LONG, MEDIUM, or SHORT).
        Returns:
        The date formatted as a String
      • date

        public static String date(Date d)
        Convert a Date into a date String using the default Locale and the DateFormat.MEDIUM size.
        Parameters:
        d - The java.util.Date to convert
        Returns:
        The date formatted as a String
      • time

        public static String time(Date d,          int dateFmt)
        Convert a Date into a time String using the default Locale
        Parameters:
        d - The java.util.Date to convert
        dateFmt - The java.text.DateFormat constant to use (FULL, LONG, MEDIUM, or SHORT).
        Returns:
        The time formatted as a String
      • time

        public static String time(Date d)
        Convert a Date into a time String using the default Locale and the DateFormat.MEDIUM size.
        Parameters:
        d - The java.util.Date to convert
        Returns:
        The time formatted as a String
      • dateTime

        public static String dateTime(Date d,              int dtFmt)
        Convert a Date into a date and time String using the default Locale
        Parameters:
        d - The java.util.Date to convert
        dtFmt - The java.text.DateFormat constant to use (FULL, LONG, MEDIUM, or SHORT).
        Returns:
        The date and time formatted as a String
      • dateTime

        public static String dateTime(Date d)
        Convert a Date into a date and time String using the default Locale and the DateFormat.MEDIUM size.
        Parameters:
        d - The java.util.Date to convert
        Returns:
        The date and time formatted as a String
      • dateTime

        public static String dateTime(Calendar c)
        Convert a Calendar into a date and time String using the default Locale and the DateFormat.MEDIUM size.
        Parameters:
        c - The java.util.Calendar to convert
        Returns:
        The date and time formatted as a String

SCaVis 1.8 © jWork.org