-
Day Of Week Error?
I'm getting the day of the week using the below code but using 19/02/2005 as the date returns Sunday when it actually is a Saturday?
Can anyone shed some light on this for me? :)
PHP Code:
$date = "19/02/2005";
echo "The day of the week is " . date('D', strtotime($date)) . ".<br>";
EDIT: Solved it by using "Amerian" date format.
When will the US join the rest of the world with "correct" date formats? :bigyello:
-
Re: Day Of Week Error?
If you want to continue to use other date formats, simply do a quick preg_replace() on your date:
PHP Code:
$date = "19/02/2005";
echo "The day of the week is " . date('D', strtotime(preg_replace('/(.*)\/(.*)\/(.*)/', '$2/$1/$3', $date))) . ".<br>";
Little more code, but it should do the trick.