time using php code example

Example 1: display time php

date(format,timestamp) 
//example
date("Y.m.d") //default timestamp is current time.

Example 2: time php

<?php 
/* Unix Timestamp */
$timestamp = time();
echo $timestamp . "<br>";
echo date("d/m/Y", $timestamp);
?>

Example 3: time function in php

Return the current time as a Unix timestamp, then format it to a date:
<?php 
/* Unix Timestamp */
$timestamp = time();
echo $timestamp . "<br>";
echo date("d/m/Y", $timestamp);
?>

Example 4: php time()

<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
                   // 7 Tage; 24 Stunden; 60 Minuten; 60 Sekunden
echo 'Jetzt:          '. date('Y-m-d') ."\n";
echo 'Naechste Woche: '. date('Y-m-d', $nextWeek) ."\n";
// oder strtotime() verwenden:
echo 'Naechste Woche: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>

Tags:

Php Example