java.lang.Object
org.rrd4j.graph.SimpleTimeLabelFormat
All Implemented Interfaces:
TimeLabelFormat

public class SimpleTimeLabelFormatextends Object implements TimeLabelFormat
Simple time label using a format similar to strftime. For more details on the supported conversions see the Date/Time Conversions section for Formatter. Examples:
  • strftime pattern: %Y-%m-%dT%H:%M:%S
  • simple date format pattern: yyyy'-'MM'-'dd'T'HH':'mm':'ss
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
    The pattern to render with - an strftime pattern or a simple date format.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new instance using a format string that is either an strftime patter or a simple date format pattern.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    format(Calendar calendar, Locale locale)
    Renders a calendar with the strftime pattern, or with a simple date format when the pattern has no %.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • format

      private final String format
      The pattern to render with - an strftime pattern or a simple date format.
  • Constructor Details

    • SimpleTimeLabelFormat

      public SimpleTimeLabelFormat(String format)
      Create a new instance using a format string that is either an strftime patter or a simple date format pattern.
      Parameters:
      format - an strftime pattern, or a simple date format pattern if it has no %
  • Method Details

    • format

      public String format(Calendar calendar, Locale locale)
      Renders a calendar with the strftime pattern, or with a simple date format when the pattern has no %.
      Specified by:
      format in interface TimeLabelFormat
      Parameters:
      calendar - calendar to use for the formatter
      locale - locale that will be used with String.format
      Returns:
      formatted string for the timestamp