Easy Tutorial
❮ Func String Quotemeta Func Array Unique ❯

PHP mktime() Function

PHP Date/Time Reference Manual

Example

Returns the UNIX timestamp of a date and then uses it to find the day of that date:


Definition and Usage

The mktime() function returns the UNIX timestamp of a date.

Note: This function is identical to gmmktime(), except that the parameters passed represent a date (not a GMT date).

Syntax

Parameter Description
hour Optional. Specifies the hour.
minute Optional. Specifies the minute.
second Optional. Specifies the second.
month Optional. Specifies the month.
day Optional. Specifies the day.
year Optional. Specifies the year.
is_dst Optional. Set to 1 if the time is during daylight saving time, 0 if not, or -1 if unknown (default). If unknown, PHP will attempt to figure it out (which may produce unexpected results). Note: This parameter was deprecated in PHP 5.1.0. Instead, the new timezone handling features are used.

Technical Details

Return Value: Returns an integer Unix timestamp, or FALSE on error.
PHP Version: 4+
--- ---
Changelog: PHP 5.3.0: E_DEPRECATED is thrown if the is_dst parameter is used. <br>PHP 5.1.0: The is_dst parameter was deprecated. E_STRICT notice is thrown if mktime() is called without parameters. Use the time() function instead. <br>
--- ---
❮ Func String Quotemeta Func Array Unique ❯