com.metamatrix.core.util
Class DateUtil

java.lang.Object
  extended by com.metamatrix.core.util.DateUtil

public final class DateUtil
extends java.lang.Object


Field Summary
static java.lang.String COMPLETE_FORMAT
           
static java.lang.String TIMESTAMP_FORMAT
           
 
Constructor Summary
DateUtil()
           
 
Method Summary
static java.util.Date convertStringToDate(java.lang.String dateString)
          Method to convert a string in the standard MetaMatrix pattern into a Date object.
static java.util.Date getCurrentDate()
           
static java.lang.String getCurrentDateAsString()
           
static java.util.Date getDate(long timestamp)
           
static java.lang.String getDateAsString(java.util.Date timestamp)
           
static java.lang.String getDateAsString(long timestamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPLETE_FORMAT

public static final java.lang.String COMPLETE_FORMAT
See Also:
Constant Field Values

TIMESTAMP_FORMAT

public static final java.lang.String TIMESTAMP_FORMAT
See Also:
Constant Field Values
Constructor Detail

DateUtil

public DateUtil()
Method Detail

convertStringToDate

public static final java.util.Date convertStringToDate(java.lang.String dateString)
                                                throws java.text.ParseException
Method to convert a string in the standard MetaMatrix pattern into a Date object. The pattern is yyyy-MM-dd'T'HH:mm:ss.SSS-ZZ:zz where
 Symbol   Meaning                 Presentation        Example
 ------   -------                 ------------        -------
 y        year                    (Number)            1996
 M        month in year           (Number)            07
 d        day in month            (Number)            10
 h        hour in am/pm (1~12)    (Number)            12
 H        hour in day (0~23)      (Number)            0
 m        minute in hour          (Number)            30
 s        second in minute        (Number)            55
 S        millisecond             (Number)            978
 Z        zone offset hours       (Number)            6
 z        zone offset minutes     (Number)            30
 '        escape for text         (Delimiter)
 ''       single quote            (Literal)           '
 
The milliseconds, zone hour, and zone minutes are not required for parsing.

Parameters:
dateString - the stringified date in the format described above
Returns:
the Date instance
Throws:
java.text.ParseException - if the string is not of the expected format

getDateAsString

public static final java.lang.String getDateAsString(java.util.Date timestamp)

getDateAsString

public static final java.lang.String getDateAsString(long timestamp)

getDate

public static final java.util.Date getDate(long timestamp)

getCurrentDateAsString

public static final java.lang.String getCurrentDateAsString()

getCurrentDate

public static final java.util.Date getCurrentDate()


Copyright © 2009. All Rights Reserved.