echo date('Y-m-d',strtotime('02-12-13'));
英語形式なので
期待される出力:2013-12-02
私の出力:2002-12-13
誰が何が起こっているのか知っていますか?
echo date('Y-m-d',strtotime('02-12-13'));
英語形式なので
期待される出力:2013-12-02
私の出力:2002-12-13
誰が何が起こっているのか知っていますか?
マニュアルで指定されているように、「xx-xx-xx」は「yy-mm-dd」として解釈されます: http://www.php.net/manual/en/datetime.formats.date.php
You have to use date_parse_from_format () and use the returned array to build the correct format.
http://de3.php.net/manual/en/function.date-parse-from-format.php
however, maybe it is better to just format your original us date string with simple string manipulation.
Convert UK date to US date in PHP with different separator
list($date,$month,$year) = sscanf("01/01/2012", "%d/%d/%d");
echo "$month-$date-$year";