| java.lang.Object org.mmbase.datatypes.DateTimePattern
DateTimePattern | public class DateTimePattern implements Cloneable,java.io.Serializable(Code) | | This is a bit like SimpleDateFormat, because it accepts the same pattern String. It can also
parse the String though (see
DateTimePattern.getList ), which can be used to do something else
for parsing or formatting (think: format an editor entry).
This utility class is of course used in the implementation of
DateTimeDataType .
author: Michiel Meeuwissen since: MMBase-1.8 version: $Id: DateTimePattern.java,v 1.15 2007/10/17 08:18:40 michiel Exp $ |
Inner Class :public static class Element | |
getDateFormat | public DateFormat getDateFormat(Locale locale)(Code) | | Returns a DateFormat object associated with this object.
|
getElement | public static Element getElement(char c, Calendar minDate, Calendar maxDate)(Code) | | Returns an
Element structure assiocated with the characters of the format
pattern. This utility function can be usefull when generating drop-downs based on the result
of
DateTimePattern.getList .
Parameters: c - The pattern character. 'y', 'M', 'd', 'H', 'K', 'h', 'k', 'm', 's', 'E', 'w', 'D', 'F', 'G', 'a', or 'S'. Also u is recognized (as in the ICU version of SimpleDateFormat), for years which can also be negative (targeted at GregorianCalendar with 2 era's) Parameters: minDate - If for example the parameter is 'y' then the 'getMin' property of the resultElement will be the year of this date. Parameters: maxDate - If for example the parameter is 'y' then the 'getMax' property of the resultElement will be the year of this date. |
getList | public List<String> getList(Locale locale)(Code) | | Returns the pattern 'parsed'. This means that is is a List of Strings. If the string is
introduced by a quote, then it is a literal string, otherwise it is a format-string,
consisting only of a number of the same letters (e.g. yyy). So by checking the first
character you can decide what to do with it. If for example you are making an editor, and
the first char is an quote, you may decide to do either nothing, or to write it out (without
the quote). If the first character is e.g. 'y' you can make an input box for the year (you
could also attribute some meaning to the length of the string then).
|
|
|