Home >>PHP Date Time Functions >PHP date_timestamp_get() Function

PHP date_timestamp_get() Function

PHP date_timestamp_get() Function

PHP date_timestamp_get() function is used to gets the Unix timestamp. It returns the Unix timestamp representing the given input date. It accepts only a single parameter $object that is the DateTime object which is returned by the date_create() function.

Syntax:

  date_timestamp_get($object );

Parameter Values

Parameter Description
object This is a required parameter. This parameter defines a DateTime object returned by date_create().

Here is an example of date_timestamp_get() function in PHP:

<html>
<body>
<?php
$date=date_create();
echo date_timestamp_get($date);
?>
</body>
</html>
Output:
1580534023

Example 2:

<html>
<body>
<?php
$date=date_create("14-02-2020");
echo date_timestamp_get($date);
?>
</body>
</html>
Output:
1581638400

No Sidebar ads