|
DateTime::__constructdate_createReturns new DateTime object DescriptionObject oriented style
public DateTime::__construct
([ string
$time = "now"
[, DateTimeZone $timezone = NULL
]] )Procedural style
DateTime date_create
([ string
$time = "now"
[, DateTimeZone $timezone = NULL
]] )Returns new DateTime object. Parameters
Return Values
Returns a new DateTime instance.
Procedural style returns Errors/ExceptionsEmits Exception in case of an error. Changelog
ExamplesExample #1 DateTime::__construct example Object oriented style
<?php Procedural style
<?php The above examples will output: 2000-01-01 Example #2 Intricacies of DateTime::__construct
<?php The above example will output something similar to: 2000-01-01 00:00:00-05:00 2000-01-01 00:00:00+12:00 2010-04-24 10:24:16-04:00 2010-04-25 02:24:16+12:00 2000-01-01 00:00:00+00:00 2000-03-01 00:00:00-05:00 See Also
|