php.js : mktime() function
mktime() function
The mktime() function returns the UNIX timestamp for a particular date.
Version
1103.1210
Syntax:
mktime(hour, minute, second, month, day, year, is_dst)
Parameters:
Name | Description | Required/ Optional |
Type |
---|---|---|---|
hour | Numeric representation of hours | Optional | Integer |
minute | Numeric representation of minute | Optional | Integer |
second | Numeric representation of second | Optional | Integer |
month | Numeric representation of month | Optional | Integer |
day | Numeric representation of day | Optional | Integer |
year | Numeric representation of year | Optional | Integer |
is_dst | Whether Daylight Saving Time is active (values 1 or 0 ). In PHP 5.1.0, this parameter became deprecated. As a result, the new timezone handling features should be used instead. | Optional | Integer |
Example of php.js mktime() function
In the following web document mktime() function returns the UNIX timestamp for a particular date.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>php.js : mktime() function example</title>
<script type="text/javascript" src="../../phpjs/date/datetime.min.js"> </script>
</head>
<body>
<h1 style="color: green">php.js : mktime() function example</h1>
<h3>UNIX timestamp for a particular date</h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
document.write('mktime(14, 11, 2, 2, 1, 2006)'+'<br />');
document.write(mktime(14, 11, 2, 2, 1, 2006));
//]]>
</script>
</body>
</html>
Output of the example:
mktime(14, 11, 2, 2, 1, 2006) 1138783262
Output vary time to time as current time changes.
View the example of php.js mktime() function in the browser
Previous: php.js : microtime() function
Next:
php.js : strftime() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/phpjs/date/mktime.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics