Create a new DateTime object with a given timezone, and then format the date and time in PHP
Description
The following code shows how to create a new DateTime object with a given timezone, and then format the date and time.
Example
//from w ww. ja v a 2 s. c om
<?php
$date=date_create("2014-03-15 23:40:00",timezone_open("Europe/Oslo"));
echo date_format($date,"Y/m/d H:iP");
?>
The code above generates the following result.