Time() Function in PHP
What is a time() Function?
Explanation
The "time()" function is used to return the current Unix timestamp.
Syntax:
time(void)
In the above syntax the current time is measured using the Unix epoch.
Example :
<?php
$a = time();
echo "Current time in Unix Time Stamp:: $a";
?>
Result :
Current time in Unix Time Stamp:: 1247543730
In the above example, the time is displayed in Unix Epoch Format.
Example :
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
echo 'Now: '. date('Y-m-d') ."n";
?>
Result :
Now: 2005-03-30
In the above example the date() function is used to return the date in YY-MM-DD (year, month, day) format.
Note :
(PHP 4, PHP 5)