Class TLcdSymbologyDateFormat

java.lang.Object
java.text.Format
com.luciad.text.TLcdSymbologyDateFormat
All Implemented Interfaces:
Serializable, Cloneable

public class TLcdSymbologyDateFormat extends Format
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:
  • 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 invoke setWithSeconds(boolean) to be able to format "ddHHmmssMMMyy" which has seconds data.

      To provide custom formats you can use TLcdSymbologyDateFormat(String)

      See Also:
    • TLcdSymbologyDateFormat

      public TLcdSymbologyDateFormat(String aFormatString)
      Creates a new symbology date format for the UTC timezone according to the provided format string.
      
         <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>   ::= ":" | "-" | "."
       
      All the elements are mandatory except <second> and <separator>. One can change the placement of the elements as well. Typical examples are;
      • "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

      public TimeZone getTimeZone()
      Returns the timezone that is used when formatting a date.
      Returns:
      the timezone that is used when formatting a date.
    • setTimeZone

      public void setTimeZone(TimeZone aTimeZone)
      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 by TLcdSymbologyDateFormat(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 is false. Note that this has no effect on parsing. Format.parseObject(String) accepts string with or without seconds regardless of this property.
      Parameters:
      aWithSeconds - true if the seconds should be formatted/parsed.
    • format

      public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
      Specified by:
      format in class Format
    • parseObject

      public Object parseObject(String source, ParsePosition pos)
      Specified by:
      parseObject in class Format