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.
I am trying to format an date received as 31/12/2012 to 2012-12-31.
I have used ::format and ::toServer, but I get 2012-31-12 instead of 2012-12-31.
How can I do it ?
Thank you!
尝试这个:
//via Time helper echo $this->Time->format('Y-m-d', "31/12/2012"); //via CakeTime utility echo CakeTime::format('Y-m-d', "31/12/2012");
来自 CakePHP 1.3 手册:
(...) 格式是 PHP 日期函数的包装器。