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.

Note

This function is retained for compatibility, but use of SetXLabelType is preferred.

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 X tick labels, and also to X data labels unless overridden by SetXDataLabelType.

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).

History

Starting with PHPlot-5.0.6, the time format can be set with SetXLabelType instead.

The default time format was undefined prior to PHPlot-5.0rc3.

SourceForge.net Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.