PHP mktime() Funktion

Beispiel

Rückgabe eines UNIX-Zeitstempels für ein Datum. Verwenden Sie ihn dann, um den Tag des Datums zu finden:

<?php
// Output: October 3, 1975 was on a Friday
echo "Oct 3, 1975 was on a ".date("l", mktime(0,0,0,10,3,1975));
?>

Run Example

Definition and Usage

The gmmktime() function returns the UNIX timestamp of the date.

Tip:This function is similar to gmmktime() The same, the difference is that the parameters passed represent the date (not the GMT date).

Syntax

mktime(hour,minute,second,month,day,year,is_dst);
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. If the time is during daylight saving time (DST), set it to 1, otherwise set it to 0, or -1 if unknown (default).

If unknown, PHP will look for itself (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 if an error occurs.
PHP Version: 4+
Update Log:

PHP 5.3.0: If used is_dst If parameters are omitted, E_DEPRECATED is thrown.

PHP 5.1.0: The is_dst parameter is deprecated. If mktime() is called without parameters, it will throw an E_STRICT notification. Please use the time() function instead.