PHP: Strtotime / date ignoring timezone?
having some trouslb with strtotime, its easier to show by example :)
date_default_timezone_set('Europe/London'); // Set timezone to local /
echo date("d/m/Y", strtotime("1-6-2003")); // Expected: 01/06/2003 Got: 01/06/2003
echo date("d/m/Y", strtotime("16-12-2003")); // Expected: 16/12/2003 Got: 16/12/2003
echo date("d/m/Y", strtotime("10-12-03")); // Expected: 10/12/2003 Got: 03/12/2010
Any ideas how to get around this problem? I am using strtotime to try and negate problems with users entering dates in different form开发者_运维百科ats.
Thank you for reading,
Rik.
strtotime
does not support that kind of date format. See the documentation for a list of supported formats. Read the documentation next time.
精彩评论