PHP
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

date_default_timezone_get> <date_create
Last updated: Fri, 02 Jan 2009

view this page in

date_date_set

(PHP 5 >= 5.2.0)

date_date_setSets the date

Opis

void date_date_set ( DateTime $object , int $year , int $month , int $day )
void DateTime::setDate ( int $year , int $month , int $day )

Resets the current date of the DateTime object to a different date.

Parametry

object

Tylko styl proceduralny: Obiekt DateTime zwracany przez date_create()

year

Year of the date.

month

Month of the date.

day

Day of the date.

Zwracane wartości

Returns NULL on success or FALSE on failure.

Przykłady

Example #1 Object oriented example usage

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

$datetime = new DateTime('2008-08-03 14:52:10');
$datetime->setDate(20081012);

echo 
$datetime->format(DATE_RFC2822);
?>

Example #2 Procedural example usage

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

$datetime date_create('2008-08-03 14:52:10');
date_date_set($datetime20081012);

echo 
date_format($datetimeDATE_RFC2822);
?>

Powyższy przykład wyświetli:

Sun, 12 Oct 2008 14:52:10 +0100



add a note add a note User Contributed Notes
date_date_set
There are no user contributed notes for this page.

date_default_timezone_get> <date_create
Last updated: Fri, 02 Jan 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites