www.webdeveloper.com
Results 1 to 3 of 3

Thread: Coverting MySQL date to date("D M j") HOW

  1. #1
    Join Date
    Jan 2005
    Posts
    361

    Question Coverting MySQL date to date("D M j") HOW

    Hi,
    I want to out put the day of the week from MySQL I know date() can convert the timestam but mysql date is not a time stam so im not really sure how to show the date in more useful way

    Can some on help me?
    2007-02-09 ==> Wed, July 02, 2007

    Thanks for help!
    ------
    What am I doing?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,432
    Two choices:

    (1) Have your query return a UNIX timestamp value via the MySQL UNIX_TIMESTAMP() function.

    ...or...

    (2) Use the PHP strtotime() function to convert the date string from your query into a timestamp, e.g.:
    PHP Code:
    $formatted_date date('D M j'strtotime($row['date'])); 
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jan 2005
    Posts
    361
    that works!

    Thanks a LOT!
    ------
    What am I doing?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles