gettime
Summary
Converts a UNIX timestamp to a human friendly structure.
Usage
gettime( timestamp )
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| timestamp | integer | A UNIX timestamp. | Yes. |
Returns
An associative array (see below).
Description
This operator takes a UNIX timestamp as a parameter and returns an associative array that contains a human friendly representation of the provided timestamp. The following table shows the keys of the returned hash.
| Key | Type | Description |
|---|---|---|
| seconds | integer | Number of seconds. |
| minutes | integer | Number of minutes. |
| hours | integer | Number of hours. |
| day | integer | The day of the month (1-31). |
| month | integer | The month number (1 is January). |
| year | integer | A four digit representation of the year (for example "1978"). |
| weekday | integer | The day of the week (1-7). |
| weeknumber | string | The week of the year (1-52). |
| yearday | integer | The day of the year (1-365). |
| epoch | integer | The UNIX timestamp that was provided. |
Examples
Example 1
{gettime( currentdate() )|attribute(show)}The "currentdate" operator is used to generate the UNIX timestamp for the current date/time. This value is then fed to the "gettime" operator, which converts it to a human friendly structure. The array is viewed using the "attribute" operator. The following output will be produced:
| Attribute | Type | Value |
|---|---|---|
| seconds | integer | 11 |
| minutes | integer | 5 |
| hours | integer | 15 |
| day | integer | 13 |
| month | integer | 4 |
| year | integer | 2005 |
| weekday | integer | 4 |
| weeknumber | string | 15 |
| yearday | integer | 102 |
| epoch | integer | 1113397511 |
Changed in Exponential 6.0.15
The named parameters of the operator gettime in Exponential 6.0.15 (eZTemplateLocaleOperator::namedParameterList(), lib/eztemplate/classes/eztemplatelocaleoperator.php), by position:
| Position | 6.0.15 (name in the code) | This page |
|---|---|---|
| 1 | timestamp, required: No. | timestamp, required: Yes. |
Comments
Add a comment