#1
  1. No Profile Picture
    quazzy
    Guest
    Devshed Newbie (0 - 499 posts)
    is there a way to get the weekday from the MySQL date format yyyy/mm/dd??

    thnx
  2. #2
  3. No Profile Picture
    jpenix
    Guest
    Devshed Newbie (0 - 499 posts)
    First chop the MySQL date up into three variables - $year, $month and $day.

    Then use a combination of the mktime() and date() commands. Mktime can turn $month/$day/$year into a Unix timestamp and then date() turns the timestamp into a string formatted however you like. For example:

    $weekday = date("l", mktime(0,0,0,$month,$day,$year));
    $print ($weekday);

    Will print out the day of the week spelled in full.

    Check the manual for details on the date and mktime functions.

Similar Threads

  1. database date selection problem
    By kidsleep in forum MySQL Help
    Replies: 0
    Last Post: January 31st, 2004, 10:50 AM
  2. Converting a date to a weekday
    By moorstream in forum PHP Development
    Replies: 1
    Last Post: October 9th, 2003, 06:13 AM
  3. date addition problem
    By strange1 in forum PHP Development
    Replies: 3
    Last Post: October 6th, 2003, 04:01 PM
  4. Javascript date validation: advance to next valid date
    By TruckStuff in forum JavaScript Development
    Replies: 2
    Last Post: September 19th, 2003, 11:21 AM
  5. MIME mail headers (date)
    By aidanpeiser in forum PHP Development
    Replies: 0
    Last Post: May 23rd, 2003, 04:07 AM

IMN logo majestic logo threadwatch logo seochat tools logo