Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php日期格式异常_Php_Mysql - Fatal编程技术网

php日期格式异常

php日期格式异常,php,mysql,Php,Mysql,我试图格式化来自mysql表的时间戳,它存储为字符串 格式如下:美国东部夏令时16/08/16下午4:41 当我尝试date('Y-m-dh:I:s',$timestamp')时,我得到一个格式不正确的错误。此格式16/08/16 4:41 PM EDT不是时间戳格式。时间戳是一个类似于1471385740的整数 对于这些转换,我使用: 您的数据是时间戳还是字符串?date函数期望第二个参数有一个时间戳,这可能是您出错的原因。另外,MySQL有几种数据类型用于存储日期/时间,以帮助您避免将它们存

我试图格式化来自mysql表的时间戳,它存储为字符串

格式如下:美国东部夏令时16/08/16下午4:41


当我尝试date('Y-m-dh:I:s',$timestamp')时,我得到一个格式不正确的错误。

此格式
16/08/16 4:41 PM EDT
不是时间戳格式。时间戳是一个类似于
1471385740
的整数

对于这些转换,我使用:


您的数据是时间戳还是字符串?
date
函数期望第二个参数有一个时间戳,这可能是您出错的原因。另外,MySQL有几种数据类型用于存储日期/时间,以帮助您避免将它们存储为字符串。Use
strotime()
dd/mm/yy是一种欧洲格式,它使用
strotime()
而不是
//code>。将
/
替换为
-
$format = "yy-MM-dd hh:MM:ss a zzz"
$date = new Zend_Date($format, "16/08/16 4:41 PM EDT");
echo $date->get('yyyy-MM-dd'); // desired format