show date php
#Dates
<?php
echo date('d'.'/'); // day
echo date('m'.'/'); // month
echo date('Y'.' '); // year
echo date('l'); // day of the week
echo date('<br> '.'Y/m/d'.' '.'l'); // Combined
echo date('<br> '.'m/d/Y'.' '.'l'); // Combined
echo date('<br> '.'m-d-Y'.' '.'l'); // Combined with dashes
echo date(' '.'h'); // hour
echo date(':'.'i'); // minutes
echo date('::'.'s'); // seconds
echo date(' - '.'a'); // AM or PM
echo date(' '.'h:i:sa'); // combined
//set time zone
date_default_timezone_set('America/New_York');
echo date(' '.'h:i:sa'); // combined
/*
Unix time stamp is a long integer
containing the number of
seconds between the unix
Epoc (january 1 1970 00:00"00
GMT) and the time specified.
*/
$timestamp = mktime(06, 30, 23, 12, 5, 1992);
echo '<br> My time stamp birthday: '.$timestamp.'<br>';
echo date('m/d/y h:i:sa', $timestamp);
//String to time
$timestamp2 = strtotime('6:30am February 05 1962');
$timestamp3 = strtotime('tomorrow');
$timestamp4 = strtotime('next Sunday');
$timestamp5 = strtotime('+2 Months');
echo '<br>'.$timestamp2.'<br>';echo '<br>'.$timestamp2.'<br>';
echo date('m/d/y h:i:sa', $timestamp2);
echo '<br>'.date('m/d/y h:i:sa', $timestamp3);
echo '<br>'.date('m/d/y h:i:sa', $timestamp4);
echo '<br>'.date('m/d/y h:i:sa', $timestamp5);
<?php
// Définit le fuseau horaire par défaut à utiliser. Disponible depuis PHP 5.1
date_default_timezone_set('UTC');
// Affichage de quelque chose comme : Monday
echo date("l");
// Affichage de quelque chose comme : Monday 8th of August 2005 03:12:46 PM
echo date('l jS \of F Y h:i:s A');
// Affiche : July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
/* utilise les constantes dans le paramètre format */
// Affichage de quelque chose comme : Wed, 25 Sep 2013 15:28:57 -0700
echo date(DATE_RFC2822);
// Affichage de quelque chose comme : 2000-07-01T00:00:00+00:00
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>