Learning PHP
Advanced PHP
PHP Function Reference
PHP Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
PHP Function time()
Syntax
Definition and Usage
The time() function returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
Paramters
Parameter | Description |
void | NA |
Return Value
Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
Example
Following is the usage of this function:
<?php
// 7 days; 24 hours; 60 mins; 60secs
$nextWeek = time() + (7 * 24 * 60 * 60);
echo 'Now: '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
?>
|
This will produce following result:
Now: 2005-03-30
Next Week: 2005-04-06
|
|
|
|