Results 1 to 2 of 2

Thread: Day Of Week Error?

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved 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.

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width