|
-
Feb 8th, 2005, 09:08 PM
#1
Thread Starter
PowerPoster
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?
Last edited by lintz; Feb 8th, 2005 at 09:33 PM.
-
Feb 14th, 2005, 03:44 PM
#2
Stuck in the 80s
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|