这里是我的转换:
function add_date($givendate,$hr=2)
{
$cd = strtotime($givendate);
$newdate = date('Y-m-d H:i:s', mktime(date('h',$cd)+$hr, date('i',$cd), date('s',$cd), date('m',$cd), date('d',$cd), date('Y',$cd)));
return $newdate;
}
http://www.symfony-project.org/reference/1_4/en/04-Settings#chapter_04_sub_default_timezone
默认时区设置
您必须在settings.yml
:
default_culture: af # or maybe af-ZA
default_timezone: Africa/Johannesburg
在此设置在您的会话中生效之前,您可能需要重新启动会话(清除cookie)。
For 12小时格式
return date("g:i a", strtotime("13:30:30"))
返回1:30 pm
For 24小时格式
return date("H:i:s", strtotime("1:30 pm"))
返回13:30:00