|
| WHAT THE time() FUNCTION DOES IN PHP AND HOW TO USE IT
The time() function returns the current Unix Timestamp in seconds since 00:00:00 GMT on 1 January 1970.
The general format of the date function is as follows:
time();
If you echo this you will get:
1328569896
Whilst this might not make sense on it's own, you could probably use this function for something like this.
$inTwoDays = time() + (2 * 24 * 60 * 60);// converting 2 days all to seconds
echo date("d-m-Y",$inTwoDays);
This will output:
08-02-2012
You use the time() function to form dates in future, present and past on the Unix timestamp seconds level and then format them to readable format as you require it.
See also:
date()
mktime()
gmdate()
strtotime()
microtime()
|
|