PHP – Time and Date Functions

The time() and date() functions allow you to add time data to your applications. Time() provides the seconds since Unix Epoch (January 1, 1970) which is useful for basic timing in your application. The date() function shows time and date information in human readable format and can be used to pull out things such as Days, Years and Months from time() results.

time()

date()

timeDate.php

<?php
$timestamp = time();

echo $timestamp;

echo "<br><br>";

echo date("M Y D h:i:s A");

echo "<br><br>";

echo date("D h:i:s",$timestamp);

echo "<br><br>";

$timestampManual = "1387631692";

echo date("M Y D h:i:s",$timestampManual);

echo "<br><br>";

$testDay = date("l",$timestampManual);

echo $testDay;
?>

Be the first to comment

Leave a Reply