<?php
/*
Using timezone and the given date/time format,
creates a UTC DATETIME object for use in a MySQL
database.
*/
function convert_timestamp($timestamp, $timezone)
{
$tz = new DateTimeZone($timezone);
$raw = DateTime::createFromFormat('n/j/Y G:i', $timestamp, $tz);
$utc = new DateTimeZone("UTC");
$raw->setTimezone($utc);
return $raw->format('Y-m-d G:i:s');
}
echo convert_timestamp("7/19/2014 8:00", "CST");
?>