Package com.twelvemonkeys.util
Class TimeFormat
java.lang.Object
java.text.Format
com.twelvemonkeys.util.TimeFormat
- All Implemented Interfaces:
Serializable
,Cloneable
Format for converting and parsing time.
The format is expressed in a string as follows:
- m (or any multiple of m's)
- the minutes part (padded with 0's, if number has less digits than the number of m's) m -> 0,1,...,59,60,61,... mm -> 00,01,...,59,60,61,...
- s or ss
- the seconds part (padded with 0's, if number has less digits than the number of s's) s -> 0,1,...,59 ss -> 00,01,...,59
- S
- all seconds (including the ones above 59)
May not handle all cases, and formats... ;-) Safest is: Always delimiters between the minutes (m) and seconds (s) part.
Known bugs:
The last character in the formatString is not escaped, while it should be. The first character after an escaped character is escaped while is shouldn't be.
This is not a 100% compatible implementation of a java.text.Format.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final TimeFormat
The default time format(package private) static final String
protected String
protected TimeFormatter[]
The formatter array.(package private) static final String
(package private) static final String
(package private) static final String
-
Constructor Summary
ConstructorsConstructorDescriptionTimeFormat
(String pStr) Creates a new TimeFormat with the given formatString, -
Method Summary
Modifier and TypeMethodDescriptionFormats the the given time, using this format.format
(Object pObj, StringBuffer pToAppendTo, FieldPosition pPos) DUMMY IMPLEMENTATION!!Gets the format string.static TimeFormat
DUMMY IMPLEMENTATION!! Not locale specific.(package private) static void
Main method for testing ONLYParses a Time, according to this format.parseObject
(String pStr, ParsePosition pStatus) DUMMY IMPLEMENTATION!!Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
Field Details
-
MINUTE
- See Also:
-
SECOND
- See Also:
-
TIME
- See Also:
-
ESCAPE
- See Also:
-
DEFAULT_FORMAT
The default time format -
formatString
-
formatter
The formatter array.
-
-
Constructor Details
-
TimeFormat
Creates a new TimeFormat with the given formatString,
-
-
Method Details
-
main
Main method for testing ONLY -
getInstance
DUMMY IMPLEMENTATION!! Not locale specific. -
getFormatString
Gets the format string. -
format
DUMMY IMPLEMENTATION!! -
format
Formats the the given time, using this format. -
parseObject
DUMMY IMPLEMENTATION!!- Specified by:
parseObject
in classFormat
-
parse
Parses a Time, according to this format.Will bug on some formats. It's safest to always use delimiters between the minutes (m) and seconds (s) part.
-