PHP | date_timestamp_get() Function
The date_timestamp_get() function is an inbuilt function in PHP which is used to gets the Unix timestamp. This function returns the Unix timestamp representing the date.
Syntax:
Parameters: This function accepts single parameter $object which is a mandatory. It is used to specify the DateTime object which is returned by the date_create() function. It is used in procedural style only. The object oriented style does not accept any parameter.
Return Value: This function returns the Unix timestamp representing the date.
Below programs illustrate the date_timestamp_get() function in PHP:
Program 1:
<?php
$date = date_create();
echo date_timestamp_get( $date );
?>
|
Program 2:
<?php
$date = new DateTime();
echo $date ->getTimestamp();
?>
|
Related Articles:
Reference: http://php.net/manual/en/datetime.gettimestamp.php
Last Updated :
17 Sep, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...