I want to read a string in a data-format, what is wrong:
$value = "Sat, 07 May 2016 02:00 AM EEST";
$time = DateTime::createFromFormat('D, d M Y g:i A', "$value");
echo $time->format('g:i');
I want to read a string in a data-format, what is wrong:
$value = "Sat, 07 May 2016 02:00 AM EEST";
$time = DateTime::createFromFormat('D, d M Y g:i A', "$value");
echo $time->format('g:i');
收起
Your date format string needs to include a timezone identifier to handle the EEST
part of the string.
$value = "Sat, 07 May 2016 02:00 AM EEST";
$time = DateTime::createFromFormat('D, d M Y g:i A T', "$value");
// Add a timezone identifier ^
echo $time->format('g:i');
报告相同问题?