time


time apg

RETURNS the current UNIX timestamp, this is, the current time measured in the number of seconds since the UNIX Epoch, (January 1 1970 00:00:00 UTC).



<?php

int time 
( )

?>

 UNIX TIMESTAMP 


The UNIX timestamp is a way to track time as a running total of seconds.

This count starts at the UNIX Epoch on January 1 1970 00:00:00 UTC.

Therefore, the UNIX timestamp is merely the number of seconds between a particular date and the UNIX Epoch.

It should also be pointed out that this point in time technically does not change no matter where you are located on the globe.

This is very useful to computer systems for tracking and sorting dated information in dynamic and distributed applications both online and client side.

Since PHP 5.1.0 - the timestamp of the start request is available in the variable $_SERVER['REQUEST_TIME'].





TIMESTAMP

The TIMESTAMP value is independent of the chosen TIMEZONE

It will be expressed - always - in relation to January 1 1970 00:00:00 UTC.

32 bit systems: January 19, 2038

On this date the Unix Time Stamp will cease to work due to a 32-bit overflow.

Before this moment millions of applications will need to either adopt a new convention for time stamps or be migrated to 64-bit systems which will buy the time stamp a bit more time.



  1 EXERCISE   

<?php

date_default_timezone_set
('UTC');  
$tzref date_default_timezone_get();  

$tsnow01 time();

echo 
$tsnow01 '<br><br>';

// The same result

echo $_SERVER['REQUEST_TIME'] . '<br><br>';

?>

  2 EXERCISE   

<?php

date_default_timezone_set
('Europe/Lisbon'); 
$tzref date_default_timezone_get(); 

$tsnow02a time();

echo 
$tsnow02a '<br><br>';

$tsnow02b time();

echo 
$tsnow02b '<br><br>';

?>

  3 EXERCISE   

<?php

$tsnow03 
time();

echo 
$tsnow03 '<br><br>';

?>