Class OdfNumberTimeStyle

  • All Implemented Interfaces:
    Serializable, Cloneable, Element, ElementTraversal, EventTarget, Node, NodeList, TypeInfo

    public class OdfNumberTimeStyle
    extends NumberTimeStyleElement
    Convenient functionalty for the parent ODF OpenDocument element

    This class lets you create a date style from a format string. The format string is given in the same form as Java's SimpleDateFormat class.

    The characters used are:

     a      Am/pm marker         PM
     H      Hour in day (0-23)   0
     k      Hour in day (1-24)   -- not in ODF
     K      Hour in am/pm (0-11) -- not in ODF
     h      Hour in am/pm (1-12) -- depends on AM/PM marker
     m      Minute in hour       30
     s      Second in minute     55
     S      Millisecond          -- not in ODF
     z      Time zone            -- not in ODF
     Z      Time zone RFC822     -- not in ODF
     
    See Also:
    Serialized Form
    • Constructor Detail

      • OdfNumberTimeStyle

        public OdfNumberTimeStyle​(OdfFileDom ownerDoc)
      • OdfNumberTimeStyle

        public OdfNumberTimeStyle​(OdfFileDom ownerDoc,
                                  String format,
                                  String styleName)
        Creates a new instance of OdfTimeStyle.
        Parameters:
        ownerDoc - document that this format belongs to
        format - format string for the date/time
        styleName - name of this style
    • Method Detail

      • getFormat

        public String getFormat​(boolean capsDateFormat)
        Get the format string that represents this style.
        Specified by:
        getFormat in class DataStyleElement
        Parameters:
        capsDateFormat - use capitals
        Returns:
        the format string
      • setFormat

        public void setFormat​(String format)
        Creates a <number:time-style> element based upon format.
        Specified by:
        setFormat in class DataStyleElement
        Parameters:
        format - the format for the time