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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.