PHP Portal » PHP Handbuch » DateTime::__construct

Werbung

DateTime::__construct


(PHP 5 >= 5.2.0)

DateTime::__constructReturns new DateTime object

Beschreibung

DateTime::__construct ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )

Returns new DateTime object.

Parameter-Liste

time

String in a format accepted by strtotime().

timezone

Time zone of the time.

Fehler/Exceptions

Emits Exception in case of an error.

Beispiele

PHP Code
1
2
3
date_default_timezone_set('Europe/London'); $datetime = new DateTime('2008-08-03 14:52:10'); echo $datetime->format(DATE_ATOM);