No cache version.
Caching disabled. Default setting for this page:enabled (code LNG204)If the display is too slow, you can disable the user mode to view the cached version.
DateTime::format
DateTimeImmutable::format
DateTimeInterface::format
date_format
(PHP 5 >= 5.2.1, PHP 7)
DateTime::format -- DateTimeImmutable::format -- DateTimeInterface::format -- date_format — Returns date formatted according to given format
Description
Object oriented style
public DateTime::format
( string
$format
) : string
public DateTimeImmutable::format
( string
$format
) : string
public DateTimeInterface::format
( string
$format
) : stringProcedural style
Returns date formatted according to given format.
Parameters
-
object
-
Procedural style only: A DateTime object returned by date_create()
-
format
-
Format accepted by date().
Examples
Example #1 DateTime::format() example
Object oriented style
<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>
Procedural style
<?php
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
?>
The above example will output:
2000-01-01 00:00:00
Can not display this page of the Infobrol website
Type of error (18-01)
Unknown format specifier "&"Please try again in a few minutes…
Steph