Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

gettime

Summary

Converts a UNIX timestamp to a human friendly structure.

Usage

gettime( timestamp )

Parameters

NameTypeDescriptionRequired
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

Balazs Halasy (21/03/2005 9:40 am)

Svitlana Shatokhina (23/01/2006 3:23 pm)


Comments

  • Bug

    Weekdays are returned in the range 0 - Sunday to 6 - Saturday. The description in the documentation (1-7) is wrong