Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    UK
    Posts
    27

    Red face Unanswered: Convert date DD/MM/YYYY to DDD

    i have the date taken form a mySQL db set in this format - DD/MM/YYYY - (i.e. 21/01/2003), and i want it to display the day for that particular date... i.e Tuesday .......

    any suggestions
    Phil

  2. #2
    Join Date
    Oct 2002
    Location
    Plymouth UK
    Posts
    116
    There are 2 ways you could do this:

    1. Get the date from database utilities see MySQL documentation (I only know the Oracle commands)

    2. In PHP you could do this

    date("l", mktime(0,0,0,mm,dd,yyyy));

    Cutting the month, day and year parts from your date string. This would return the day

    e.g.
    echo (date("l", mktime(0,0,0,4,8,2003)));

    would return Tuesday.

  3. #3
    Join Date
    Apr 2003
    Posts
    3
    DATE_FORMAT(date,format)

    Where format:
    %W Weekday name (Sunday..Saturday)

    eg.:
    SELECT DATE_FORMAT(date_field,"%W") as date_field FROM table


    visit www.php.net/manual/en/function.date.php and search for:
    junk at glued2 dot net
    16-Feb-2002 07:54

    You'll get a full list

Posting Permissions

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