DateTime::getOffset
DateTime::getTimezone
DateTime
PHP Manual

# DateTime::getTimestamp

(PHP 5 >= 5.3.0)

DateTime::getTimestamp — Gets the Unix timestamp

### Beschreibung

Objektorientierter Stil

public int DateTime::getTimestamp ( void )

Prozeduraler Stil

int date_timestamp_get ( DateTime `$object` )

Gets the Unix timestamp.

### Parameter-Liste

Diese Funktion hat keine Parameter.

### Rückgabewerte

Returns the Unix timestamp representing the date.

### Beispiele

Beispiel #1 DateTime::getTimestamp() example

Objektorientierter Stil

`<?php
$date = new DateTime();
echo $date->getTimestamp();
?>`

Prozeduraler Stil

`<?php
$date = date_create();
echo date_timestamp_get($date);
?>`

The above examples will output something similar to:

    1272509157

### Anmerkungen

Using U as the parameter to DateTime::format() is an alternative when using PHP 5.2.

### Siehe auch

- DateTime::setTimestamp() - Sets the date and time based on an Unix timestamp
- DateTime::format() - Returns date formatted according to given format

DateTime::getOffset
DateTime::getTimezone
DateTime
PHP Manual