douzhanglu4591
2014-06-19 19:11
浏览 53
已采纳

转换日期保持失败dd / mm / yyyy HH:ii

I'm desperately looking to convert my date to Y-m-d H:i My date: 19/06/2014 09:30

I tried this:

$show_date = DateTime::createFromFormat('d/m/Y', $dateValue)
    ->format('Y-m-d');

But this will give the error: Fatal error: Call to a member function format() on a non-object

I tried with the Procedural style, yet that doesn't work.

date('Y-m-d H:i', strtotime(dateValue));

I tried some other stuff and nothing seems to work. Can't even convert it to unix. Anyone has an idea?

1条回答 默认 最新

相关推荐 更多相似问题