Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个格式为 mm-dd-yyyy 的日期。我需要转换为 YYYY-MM-dd 以存储在数据库中。我做了以下
$eff_date=$this->post['effective_date']; $eff_date=$eff_date->toString('YYYY-MM-dd');
我收到以下错误:
在非对象上调用成员函数 toString()
我不知道如何解决它。
$eff_date 是 Zend_Date 对象吗?还是只是一个字符串?如果它只是一个字符串,你需要先实例化 Zend_Date 对象:
<?php $eff_date = new Zend_Date($this->post['effective_date'], 'mm-dd-yyyy', 'en'); $eff_date = $eff_date->get('YYYY-MM-dd');