php.js : mktime() function

mktime() function

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




mktime(hour, minute, second, month, day, year, is_dst)


Name Description Required/
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"
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <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>
 <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));

Output of the example:

mktime(14, 11, 2, 2, 1, 2006)

Output vary time to time as current time changes.

View the example of php.js mktime() function in the browser

Download phpjs.zip

Previous: php.js : microtime() function
Next: php.js : strftime() function

Share this Tutorial / Exercise on : Facebook and Twitter