|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.util.Strftime
public class Strftime
Converts dates to strings using the same format specifiers as strftime Note: This does not mimic strftime perfectly. Certain strftime commands, are not supported, and will convert as if they were literals. Certain complicated commands, like those dealing with the week of the year probably don't have exactly the same behavior as strftime. These limitations are due to use SimpleDateTime. If the conversion was done manually, all these limitations could be eliminated. The interface looks like a subset of DateFormat. Maybe someday someone will make this class extend DateFormat.
Added to tapestry in order to help with dojo/javascript date/time conversions.
Field Summary | |
---|---|
protected static Properties |
pTranslate
|
protected SimpleDateFormat |
simpleDateFormat
|
protected static Properties |
translate
|
Constructor Summary | |
---|---|
Strftime(String origFormat)
Create an instance of this date formatting class. |
|
Strftime(String origFormat,
Locale locale)
Create an instance of this date formatting class. |
Method Summary | |
---|---|
static String |
convertDateFormat(String pattern)
Search the provided pattern and get the C standard Date/Time formatting rules and convert them to the Java equivalent. |
static String |
convertToPosixFormat(String pattern)
Does the exact opposite of { convertDateFormat(String) by converting
the incoming java date format string into a POSIX compliant format string. |
String |
format(Date date)
Format the date according to the strftime-style string given in the constructor. |
TimeZone |
getTimeZone()
Get the timezone used for formatting conversions. |
Date |
parse(String input)
Parses the input. |
void |
setTimeZone(TimeZone timeZone)
Change the timezone used to format dates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static Properties translate
protected static Properties pTranslate
protected SimpleDateFormat simpleDateFormat
Constructor Detail |
---|
public Strftime(String origFormat)
Strftime( String, Locale )
public Strftime(String origFormat, Locale locale)
origFormat
- the strftime-style formatting stringlocale
- the locale to use for locale-specific conversionsMethod Detail |
---|
public String format(Date date)
date
- the date to format
public Date parse(String input) throws ParseException
input
- The string to parse.
Date
.
ParseException
- On input error.DateFormat.parse(String)
public TimeZone getTimeZone()
public void setTimeZone(TimeZone timeZone)
DateFormat.setTimeZone(TimeZone)
public static String convertToPosixFormat(String pattern)
convertDateFormat(String)
by converting
the incoming java date format string into a POSIX compliant format string.
pattern
- The java date format style format
public static String convertDateFormat(String pattern)
pattern
- The pattern to search
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |