PHP/Date/time

Материал из Web эксперт
Перейти к: навигация, поиск

Adding two days to the date

   <source lang="html4strict">

<?php $timestamp= time( ); echo date("m/d/y G.i:s",$timestamp); $seconds=2*24*60*60; $timestamp+=$seconds; echo "
new dates

is:";

echo date("m/d/y G.i:s",$timestamp); ?>

 </source>
   
  


Another date interval with epoch timestamps

   <source lang="html4strict">

<?php $now = time(); $next_week = $now + 7 * 86400; ?>

 </source>
   
  


A simple echo of the timestamp

   <source lang="html4strict">

<?php $timestamp= time( ); echo $timestamp; ?>

 </source>
   
  


int time ( void ) gets the current time in epoch format is time( )

   <source lang="html4strict">

<?

   print time( );
   $CurrentTime = time( );
   print $CurrentTime;

?>

 </source>