w3resource

php.js : gmmktime() function

gmmktime() function

The gmmktime() function is used to get Unix timestamp for a GMT date.

Version:

1103.1210

Syntax:

gmmktime(hour, minute, second, month, day, year)

Parameter:

Name Description Required/ Optional Type
hour Specifies the hour Optional integer
minute Specifies the minute Optional integer
second Specifies the second Optional integer
month Specifies the month Optional integer
day Specifies the day Optional integer
year Specifies the year Optional integer

Example of php.js gmmktime() function.  :

In the following web document gmmktime() function returns Unix timestamp for a given 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 : gmmktime() function example</title>
<script type="text/javascript" src="../../phpjs/date/datetime.min.js"> </script>
</head>
<body>
<h1 style="color: green">php.js : gmmktime() function example</h1>
<h3>UNIX timestamp for a GMT date</h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
document.write(gmmktime(0,0,0,10,3,1975)+'<br/>');
//]]>
</script>
</body>
</html>

Output of the function:

181526400

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

Download phpjs.zip

Previous: php.js: gmdate() function
Next: php.js : gmstrftime() function



Share this Tutorial / Exercise on : Facebook and Twitter