|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.gdata.utils.DateFormater
public class DateFormater
This class uses the SimpleDateFormat
class to format dates
into strings according to given date pattern.
As the creation of SimpleDateFormat objects is quiet expensive and formating dates is used quiet fequently the objects will be cached and reused in subsequent calls.
This implementation is thread safe as it uses Stack
as a
cache
Field Summary | |
---|---|
static String |
HTTP_HEADER_DATE_FORMAT
Date format as it is used in Http Last modified header (Tue, 15 Nov 1994 12:45:26 GMT) |
static String |
HTTP_HEADER_DATE_FORMAT_TIME_OFFSET
Date format as it is used in Http Last modified header (Tue, 15 Nov 1994 12:45:26 +0000) |
Constructor Summary | |
---|---|
protected |
DateFormater()
|
Method Summary | |
---|---|
static String |
formatDate(Date date,
String format)
Formats the given Date into the given date pattern. |
protected SimpleDateFormat |
getFormater()
|
static Date |
parseDate(String date,
String... formates)
Parses the given string into one of the specified formates |
static Date |
parseDate(String dateString,
String pattern)
Parses the given string into the specified formate |
protected void |
returnFomater(SimpleDateFormat format)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String HTTP_HEADER_DATE_FORMAT
public static final String HTTP_HEADER_DATE_FORMAT_TIME_OFFSET
Constructor Detail |
---|
protected DateFormater()
Method Detail |
---|
public static String formatDate(Date date, String format)
date
- -
the date to formatformat
- -
date pattern
public static Date parseDate(String date, String... formates) throws ParseException
date
- - the string to parseformates
- - formates
Date
instance representing the given string
ParseException
- - if the string can not be parsedpublic static Date parseDate(String dateString, String pattern) throws ParseException
dateString
- - the string to parsepattern
- - the expected formate
Date
instance representing the given string
ParseException
- - if the string can not be parsedprotected SimpleDateFormat getFormater()
protected void returnFomater(SimpleDateFormat format)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |