SetXTimeFormat

SetXTimeFormat — Set date/time formatting string for X labels

Synopsis

$plot->SetXTimeFormat($xtf)
    

Description

SetXTimeFormat sets the formatting string for X tick and data labels when 'time' formatting mode for X labels is in effect. Use SetXLabelType to select the formatting mode for labels. The formatting string is used with the PHP strftime to format labels as date/time strings.

Parameters

$xtf

Formatting string for X labels, used with strftime(). For example, if the label value is 1104534000 (which is the time_t representation of 6:00 PM on the last day of 2004), '%Y-%m-%d.%H:%M:%S' results in '2004-12-31.18:00:00', and '%d %b %Y' results in '31 Dec 2004'.

Notes

This applies to both X tick labels and X data labels. To use date/time formatting, the label values must be Unix time_t values (number of seconds since Unix epoch).

Unlike SetPrecisionX, SetXTimeFormat does not automatically enable the correct label formatting mode. You must call SetXLabelType('time') to use date/time formatting of labels.

The default time format is '%H:%M:%S', showing hours, minutes, and seconds (and ignoring any date information). This default applies to PHPlot-5.0rc3 and higher. In older versions, the default is undefined.