w3resource

php.js : time() function

time() function

The time() function returns current Unix timestamp.

Remarks : The Unix timestamp measures time as a number of seconds since midnight of Greenwich Mean Time on January 1,1970.

Version:

1103.1210

Syntax:

time()

Example of php.js time() function:

In the following web document time() function returns the current time as Unix timestamp.

<!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 : time() function example</title>
<script type="text/javascript" src="../../phpjs/date/datetime.min.js"> </script>
</head>
<body>
<h1 style="color: green">php.js : time() function example</h1>
<h3>Returns the current time as Unix timestamp.</h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
document.write(time()+'<br>');
//]]>
</script>
</body>
</html>

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

Download phpjs.zip

Previous: php.js : strtotime() function
Next: php.js : empty() function



Share this Tutorial / Exercise on : Facebook and Twitter