Package com.luciad.text
Class TLcdSymbologyDateFormat
java.lang.Object
java.text.Format
com.luciad.text.TLcdSymbologyDateFormat
- All Implemented Interfaces:
Serializable,Cloneable
This format makes it possible to convert between
java.util.Date objects and
Strings formatted as "ddHHmmssTMMMyy", with T being a timezone character, and the
other characters specified in SimpleDateFormat.
The format uses UTC ('Z', or zulu time) by default, but this can be
changed.
Example usage:
TLcdSymbologyDateFormat format = new TLcdSymbologyDateFormat();
Date date = new Date();
String formattedDate = format.format( date );
System.out.println( "date = " + date );
System.out.println( "formattedDate = " + formattedDate );
// Example output:
// date = Tue Oct 01 14:27:36 CEST 2013
// formattedDate = 01122736ZOCT13
- Since:
- 2013.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new symbology date format for the UTC timezone.TLcdSymbologyDateFormat(String aFormatString) Creates a new symbology date format for the UTC timezone according to the provided format string. -
Method Summary
Modifier and TypeMethodDescriptionformat(Object obj, StringBuffer toAppendTo, FieldPosition pos) Returns the timezone that is used when formatting a date.booleanReturns if the seconds are formatted/parsed.parseObject(String source, ParsePosition pos) voidsetTimeZone(TimeZone aTimeZone) Sets the timezone to use when formatting a Date.voidsetWithSeconds(boolean aWithSeconds) Sets if the seconds should be formatted.Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
Constructor Details
-
TLcdSymbologyDateFormat
public TLcdSymbologyDateFormat()Creates a new symbology date format for the UTC timezone. It uses "ddHHmmMMMyy" to format a date object. You can invokesetWithSeconds(boolean)to be able to format "ddHHmmssMMMyy" which has seconds data.To provide custom formats you can use
TLcdSymbologyDateFormat(String)- See Also:
-
TLcdSymbologyDateFormat
Creates a new symbology date format for the UTC timezone according to the provided format string.
All the elements are mandatory except <second> and <separator>. One can change the placement of the elements as well. Typical examples are;<pattern> ::= <day>[<separator>]<hour>[<separator>]<minute>[<separator>][<second>][<separator>]<timezone>[<separator>]<month>[<separator>]<year> <day> ::= "dd" <hour> ::= "HH" <minute> ::= "mm" <second> ::= "ss" <timezone> ::= "T" <month> ::= "MMM" <year> ::= "yy" <separator> ::= ":" | "-" | "."- "ddHHmmTMMMyy" = "121314ZJUN93"
- "dd HHmm T MMMyy" = "12 1314 Z JUN93"
- "HH-mm-ss dd-T-MMM-yy" = "13-14-15 12-Z-JUN-93"
Note that when you use this constructor,
setWithSeconds(boolean)will have no effect.- Parameters:
aFormatString- format string- See Also:
-
-
Method Details
-
getTimeZone
Returns the timezone that is used when formatting a date.- Returns:
- the timezone that is used when formatting a date.
-
setTimeZone
Sets the timezone to use when formatting a Date.- Parameters:
aTimeZone- a time zone
-
isWithSeconds
public boolean isWithSeconds()Returns if the seconds are formatted/parsed. If date format has been constructed byTLcdSymbologyDateFormat(String)this value has no effect on formatting.- Returns:
- if the seconds are formatted/parsed.
-
setWithSeconds
public void setWithSeconds(boolean aWithSeconds) Sets if the seconds should be formatted. The default value isfalse. Note that this has no effect on parsing.Format.parseObject(String)accepts string with or without seconds regardless of this property.- Parameters:
aWithSeconds-trueif the seconds should be formatted/parsed.
-
format
-
parseObject
- Specified by:
parseObjectin classFormat
-