Returns date formatted according to given format

date_format

(PHP 5 >= 5.1.0)

date_formatReturns date formatted according to given format

Opis

string date_format ( DateTime $object , string $format )
string DateTime::format ( string $format )

Parametry

object

Procedural style only: A DateTime object returned by date_create()

format

Format accepted by date().

Zwracane wartości

Returns formatted date on success or FALSE on failure.

Przykłady

Example #1 Displaying the date and time using the procedural form

<?php
date_default_timezone_set
('Europe/London');

$datetime date_create('2008-08-03 14:52:10');
echo 
date_format($datetime'jS, F Y') . "\n";
echo 
date_format($datetimeDATE_ATOM);
?>

Example #2 Displaying the date and time using the object oriented form

<?php
date_default_timezone_set
('Europe/London');

$datetime = new DateTime('2008-08-03 14:52:10');
echo 
$datetime->format('jS, F Y') . "\n";
echo 
$datetime->format(DATE_ATOM);
?>
?>

Powyższy przykład wyświetli:

3rd, August 2008
2008-08-03T14:52:10+01:00

Zobacz też:


zapalniczki zippo | biżuteria z brylantem | kolczyki | zippo sklep | cena bransoletki | długopis | aranżacja wnętrz | vision antiox | sprzedaż zegarków | serwery wirtualne | kawa krakow | rachunek zysków i strat
Design by flankerds.com