Class OdfNumberDateStyle

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

    public class OdfNumberDateStyle
    extends NumberDateStyleElement
    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:

     G      Era designator       AD
     y      Year                 1996; 96
     Q      Quarter in Year      2 -- not in Java; in ODF
     M      Month in year        July; Jul; 07
     w      Week in year         27
     W      Week in month        -- not in ODF
     D      Day in year          -- not in ODF
     d      Day in month         10
     F      Day of week in month -- not in ODF
     E      Day in week          Tuesday; Tue
     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
     
    The G, E, and y specifiers are in long form if there are more then 3 in a row. The Q specifier is in long form if there are more than 2 in a row. The d, h, and m specifiers are in long form if there is more than one in a row.
    See Also:
    Serialized Form
    • Constructor Detail

      • OdfNumberDateStyle

        public OdfNumberDateStyle​(OdfFileDom ownerDoc)
      • OdfNumberDateStyle

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

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

      • getFormat

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

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