Anonymous user / 18.119.111.9 Log In Register
?
Wallet: 3.00
Daily Credits:
1.20 / 1.20

PHP Functions Online


DateTime::getTimestamp

(PHP 5 >= 5.3.0)

DateTime::getTimestamp -- DateTimeImmutable::getTimestamp -- DateTimeInterface::getTimestamp -- date_timestamp_getGets the Unix timestamp

public int $object->getTimestamp(void)
public DateTime::__construct([string $time = "now"[, DateTimeZone $timezone = NULL]])
public DateTimeZone::__construct(string $timezone)

Checkout ? #

Item Description Item Price Your Price
Total

Preview #

${{ variable.param.name }} = {{ variable.param|getValue:variable.form:true }};
{{ call.result}} = ;

Tip: You can change some values by clicking on it in the preview above.

Description #

public int DateTime::getTimestamp ( void )

Gets the Unix timestamp.

Parameters #

Return Values #

Returns the Unix timestamp representing the date.

Examples #

Example #1 DateTime::getTimestamp() example

Object oriented style

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

Procedural style

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

The above examples will output something similar to:

1272509157

Notes #

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

See Also #