Returns new DateTime object

date_create

(PHP 5 >= 5.1.0)

date_createReturns new DateTime object

Opis

DateTime date_create ([ string $time [, DateTimeZone $timezone ]] )
DateTime DateTime::__construct ([ string $time [, DateTimeZone $timezone ]] )

Parametry

time

String in a format accepted by strtotime(), defaults to "now".

timezone

Time zone of the time.

Zwracane wartości

Returns DateTime object on success or FALSE on failure.

Przykłady

Example #1 Object oriented style

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

$datetime = new DateTime('2008-08-03 14:52:10');
echo 
$datetime->format(DATE_ATOM);
?>

Example #2 Procedural style

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

$datetime date_create('2008-08-03 14:52:10');
echo 
date_format($datetimeDATE_ATOM);
?>

Powyższy przykład wyświetli:

2008-08-03T14:52:10+01:00


biĹĽuteria z brylantem | abrys.net | projektowanie stron warszawa | wieczne piĂłro | tattoos Legnica | detox | biĹĽuteria artystyczna | ekspertyzy opinie oceny opole | domki letniskowe budowa
Design by flankerds.com