The date_create() function returns new DateTime object.
Syntax
date_create(time,timezone);
Parameters
time − Specifies a date/time string.
timezone − Specifies the timezone of time.
Return
The date_create() function returns a new DateTime object on success, FALSE on failure.
Example
The following is an example −
<?php $date = date_create("2018-07-25 21:15:00",timezone_open("Europe/Oslo")); echo date_format($date,"Y/m/d H:iP"); ?>
Output
The following is the output −
2018/07/25 21:15+02:00