Menu Samaritan's Purse

DATE_CREATE

Returns new DateTime object

SYNTAX

date_create ([ string $datetime = "now" [, DateTimeZone $timezone = NULL ]] ) : DateTime

PARAMETERS

datetime

A date/time string. Valid formats are explained in Date and Time Formats. Enter "now" here to obtain the current time when using the $timezone parameter.

timezone

A DateTimeZone object representing the timezone of $datetime. If $timezone is omitted, the current timezone will be used. Note: The $timezone parameter and the current timezone are ignored when the $datetime parameter either is a UNIX timestamp (e.g. @946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00).

RETURN

Returns a new DateTime instance. Procedural style returns FALSE on failure.

EXAMPLES

VOID

2020-10-28 09:15:35

DATETIME

2001-01-01 00:00:00

TIMEZONE

2020-10-28 05:15:35

PHP