致命错误:消息'DateTime :: __ construct()的未捕获异常'Exception':

时间:2014-02-17 19:57:57

标签: php codeigniter datetime oracle11g xampp

Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (15/JAN/20) at position 0 (1):

......第26行

$first_installment_date = new datetime($aData[0]->FIRST_INSTALL_DATE); 
php codeigniter工作正常之前...当我重新安装oracle n xampp..it显示错误

2 个答案:

答案 0 :(得分:4)

15/JAN/20)不是DateTime()的{​​{3}}。您需要使用valid format来解析该日期:

//Assuming YY/Mon/DD
$first_installment_date = DateTime::createFromFormat('y/M/d', $aData[0]->FIRST_INSTALL_DATE);

答案 1 :(得分:-1)

public __construct ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )

您确定“ $ aData [0] - > FIRST_INSTALL_DATE ”不为空?

PHP DateTime Documentation