PHP | date_timestamp_get() Function Last Updated : 17 Sep, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: Procedural style: int date_timestamp_get( $object ) Object oriented style: int DateTime::getTimestamp( void ) int DateTimeImmutable::getTimestamp( void ) int DateTimeInterface::getTimestamp( void ) 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 <?php // Create DateTime object $date = date_create(); // Display Unix timestamp date echo date_timestamp_get($date); ?> Output: 1537162804 Program 2: php <?php // Create DateTime object $date = new DateTime(); // Display Unix timestamp date echo $date->getTimestamp(); ?> Output: 1537162805 Related Articles: PHP | date_date_set() Function PHP | date_offset_get() Function PHP | gmstrftime() Function Reference: http://php.net/manual/en/datetime.gettimestamp.php Comment More infoAdvertise with us Next Article PHP | date_timestamp_set() Function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP PHP-date-time PHP-function +1 More Practice Tags : Misc Similar Reads PHP | date_timestamp_set() Function The date_timestamp_set() function is an inbuilt function in PHP which is used to sets the date and time based on an Unix timestamp. This function returns the DateTime object for method chaining or False on failure. Syntax: Procedural style: date_timestamp_set( $object, $unixtimestamp ) Object orient 2 min read PHP | date_timezone_get() Function The date_timezone_get() function is an inbuilt function in PHP which is used to return time zone relative to given DateTime. This function returns a DateTimeZone object on success or False on failure. Syntax: Procedural style: date_timezone_get( $object ) Object oriented style: DateTime::getTimezone 1 min read PHP | date_time_set() Function The date_time_set() function is an inbuilt function in PHP which is used to sets the time. This function resets the current time of the DateTime object to a different time. Syntax: Procedural style: date_time_set( $object, $hour, $minute, $second, $microseconds ) Object oriented style: DateTime::set 2 min read PHP | date_default_timezone_get() Function The date_default_timezone_get() function is an inbuilt function in PHP which is used to gets the default timezone used by all date/time functions in a script. Syntax: string date_default_timezone_get( void ) Parameter: This function does not accept any parameter.Return Value: This function returns a 2 min read PHP | DateTimeImmutable setTimestamp() Function The DateTimeImmutable::setTimestamp() function is an inbuilt function in PHP which is used to set the date and time based on an Unix timestamp. Syntax: DateTimeImmutable DateTimeImmutable::setTimestamp( int $unixtimestamp ) Parameters: This function accepts single parameter $unixtimestamp which is u 1 min read PHP | date_sunset() Function The date_sunset() is an inbuilt function in PHP which is used to find the sunset time for a specified day and location. Syntax: date_sunset ( $timestamp, $format, $latitude, $longitude, $zenith, $gmtoffset ) Parameters: This function accepts four parameters as mentioned above and described below. $t 2 min read Like