mhuss utils 1.1.5ws

com.mhuss.Util
Class DateU

java.lang.Object
  extended by com.mhuss.Util.DateU

public class DateU
extends java.lang.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
DateU()
           
 
Method Summary
static java.lang.String date(java.util.Date d)
          Convert a Date into a date String using the default Locale and the DateFormat.MEDIUM size.
static java.lang.String date(java.util.Date d, int dateFmt)
          Convert a Date into a date String using the default Locale.
static java.lang.String dateNow()
          Return 'now' as a date String using the default Locale and the DateFormat.MEDIUM size.
static java.lang.String dateNow(int dateFmt)
          Return 'now' as a date String using the default Locale
static java.lang.String dateTime(java.util.Calendar c)
          Convert a Calendar into a date and time String using the default Locale and the DateFormat.MEDIUM size.
static java.lang.String dateTime(java.util.Date d)
          Convert a Date into a date and time String using the default Locale and the DateFormat.MEDIUM size.
static java.lang.String dateTime(java.util.Date d, int dtFmt)
          Convert a Date into a date and time String using the default Locale
static java.lang.String dateTimeNow()
          Return 'now' as a date and time String using the default Locale and the DateFormat.MEDIUM size.
static java.lang.String time(java.util.Date d)
          Convert a Date into a time String using the default Locale and the DateFormat.MEDIUM size.
static java.lang.String time(java.util.Date d, int dateFmt)
          Convert a Date into a time String using the default Locale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateU

public DateU()
Method Detail

dateNow

public static java.lang.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 java.lang.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 java.lang.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 java.lang.String date(java.util.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 java.lang.String date(java.util.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 java.lang.String time(java.util.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 java.lang.String time(java.util.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 java.lang.String dateTime(java.util.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 java.lang.String dateTime(java.util.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 java.lang.String dateTime(java.util.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

mhuss utils 1.1.5ws

bottom text