توابع mktime() در PHP

مثال

بازگشت یک زمان‌ستون UNIX برای یک تاریخ. سپس از آن برای پیدا کردن روز آن تاریخ استفاده کنید:

<?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);
Parameters 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 search itself (which may produce unexpected results).

Note:This parameter was deprecated in PHP 5.1.0. Instead, use the new timezone handling features.

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 using is_dst Parameters, it will throw an E_DEPRECATED.

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