org.appfuse.util
Class DateUtil

java.lang.Object
  extended by org.appfuse.util.DateUtil

public class DateUtil
extends Object

Date Utility Class This is used to convert Strings to Dates and Timestamps

View Source

Version:
$Revision: 1.7.2.1 $ $Date: 2006-10-03 12:58:45 -0600 (Tue, 03 Oct 2006) $
Author:
Matt Raible Modified by Dan Kibler to correct time pattern. Minutes should be mm not MM (MM is month).

Constructor Summary
DateUtil()
           
 
Method Summary
static String convertDateToString(Date aDate)
          This method generates a string representation of a date based on the System Property 'dateFormat' in the format you specify on input
static Date convertStringToDate(String strDate)
          This method converts a String to a date using the datePattern
static Date convertStringToDate(String aMask, String strDate)
          This method generates a string representation of a date/time in the format you specify on input
static String getDate(Date aDate)
          This method attempts to convert an Oracle-formatted date in the form dd-MMM-yyyy to mm/dd/yyyy.
static String getDatePattern()
          Return default datePattern (MM/dd/yyyy)
static String getDateTime(String aMask, Date aDate)
          This method generates a string representation of a date's date/time in the format you specify on input
static String getDateTimePattern()
           
static String getTimeNow(Date theTime)
          This method returns the current date time in the format: MM/dd/yyyy HH:MM a
static Calendar getToday()
          This method returns the current date in the format: MM/dd/yyyy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtil

public DateUtil()
Method Detail

getDatePattern

public static String getDatePattern()
Return default datePattern (MM/dd/yyyy)

Returns:
a string representing the date pattern on the UI

getDateTimePattern

public static String getDateTimePattern()

getDate

public static final String getDate(Date aDate)
This method attempts to convert an Oracle-formatted date in the form dd-MMM-yyyy to mm/dd/yyyy.

Parameters:
aDate - date from database as a string
Returns:
formatted string for the ui

convertStringToDate

public static final Date convertStringToDate(String aMask,
                                             String strDate)
                                      throws ParseException
This method generates a string representation of a date/time in the format you specify on input

Parameters:
aMask - the date pattern the string is in
strDate - a string representation of a date
Returns:
a converted Date object
Throws:
ParseException
See Also:
SimpleDateFormat

getTimeNow

public static String getTimeNow(Date theTime)
This method returns the current date time in the format: MM/dd/yyyy HH:MM a

Parameters:
theTime - the current time
Returns:
the current date/time

getToday

public static Calendar getToday()
                         throws ParseException
This method returns the current date in the format: MM/dd/yyyy

Returns:
the current date
Throws:
ParseException

getDateTime

public static final String getDateTime(String aMask,
                                       Date aDate)
This method generates a string representation of a date's date/time in the format you specify on input

Parameters:
aMask - the date pattern the string is in
aDate - a date object
Returns:
a formatted string representation of the date
See Also:
SimpleDateFormat

convertDateToString

public static final String convertDateToString(Date aDate)
This method generates a string representation of a date based on the System Property 'dateFormat' in the format you specify on input

Parameters:
aDate - A date to convert
Returns:
a string representation of the date

convertStringToDate

public static Date convertStringToDate(String strDate)
                                throws ParseException
This method converts a String to a date using the datePattern

Parameters:
strDate - the date to convert (in format MM/dd/yyyy)
Returns:
a date object
Throws:
ParseException


Copyright � 2002-2006