$hour = $_POST['hour'];
$minute = $_POST['minute'];
$ampm = $_POST['ampm'];
$tz = $_POST['tz'];
$ftz = "America/New_York";
if($ampm == 'PM')
{
$hour = $hour + 12;
}
$temptime = strtotime("$hour" . ":". "$minute" . ":" . "00");
$tempdate = date('Y-m-d', strtotime('+1 month'));
$tempval = $tempdate . " " . $temptime;
$nextalert = new datetime ($tempval, new DateTimeZone('$tz'));
$nextalert->setTimezone(new DateTimeZone('$ftz'));
echo $nextalert ;
In my test: hour = 05 minutes= 00 seconds = 00 PM Timezone = PDT
The error I am getting
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() [<a href='datetimezone.--construct'>datetimezone.--construct</a>]: Unknown or bad timezone ($tz)'
I want the date output to be: 2010-9-16 14:00:00 EDT (3 hour pdt > edt conversion)