SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot daemon's Avatar
    Join Date
    Apr 2001
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a way to change the "date" format from the 0000-00-00 format to 00-00-0000 (day, month, year)?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, and why would you want to. You an always format the date on the way out, that is why MySQL does this, and I assume all true RDBMS(plus MySQL) do it, so they can keep a standardized way to store a date, that way you can use the plethera of built-in date functions within MySQL for instance to pulla date out of the database in the format you want you would simply include this in your select statement:

    Code:
    DATE_FORMAT(datefield, '%m-%d-%Y') as formatted_date
    And in a query

    Code:
    select DATE_FORMAT(datefield, '%m-%d-%Y') as formatted_date from tablename

    Check this out for all the functiuons you can use on date columns in MySQL
    http://mysql.he.net/documentation/my...time_functions
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

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