SetYTimeFormat
Prev | PHPlot Function Reference | Next

## SetYTimeFormat

SetYTimeFormat — Set date/time formatting string for Y labels

## Synopsis

    $plot->SetYTimeFormat($ytf)

## Description

`SetYTimeFormat` sets the formatting string for Y tick and data labels when 'time' formatting mode for Y labels is in effect. (Y data labels are only available with bar charts and stacked bar charts.) Use SetYLabelType 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 SetYLabelType is preferred.

## Parameters

`$ytf`

  Formatting string for Y 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 Y tick labels, and also to Y data labels unless overridden by SetYDataLabelType.

To use date/time formatting, the label values must be Unix time_t values (number of seconds since Unix epoch).

Unlike SetPrecisionY, SetYTimeFormat does not automatically enable the correct label formatting mode. You must call `SetYLabelType('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 SetYLabelType instead.

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

Prev | Up | Next
SetYTickPos | Home | SetYTitle