Formatting mySQL dates in PHP

Discussion in 'PHP' started by GSto, Jun 8, 2008.

  1. #1
    mySQL stores DATETIME variables in a YYYY-MM-DD HH:MM:SS format. when I use a query to get this information in PHP, how do I reformat it?

    How can I change

    2008-06-08 16:30:00

    into

    Sunday, June 6th 4:30 p.m.

    I'm assuming there is a built-in function for stuff like this.
     
    GSto, Jun 8, 2008 IP
  2. GLD

    GLD Well-Known Member

    Messages:
    307
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #2
    You should store your dates as a timestamp. You can then easily get the date in any format you require.

    If it's too late for that you can use mktime. What I would do is explode your current date a couple of times and use the pieces as arguments for mktime.

    Hope that helps.
     
    GLD, Jun 8, 2008 IP
  3. GSto

    GSto Peon

    Messages:
    218
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    From a development standpoint, I see web 2.0 as the "social web". Think sites like Facebook/Myspace (Social Networking) Digg(Social Bookmarking) , and Twitter(micro-blogging) for sites that are very 2.0

    From a design standpoint, it usually means cool colors (blue and green) rounded corners, gradients, and very minimalist looks. again, Digg and Twitter are really good examples of this kind of design.
     
    GSto, Jun 8, 2008 IP
  4. GSto

    GSto Peon

    Messages:
    218
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    whoops, my mistake, that was supposed to be a response to another thread
     
    GSto, Jun 10, 2008 IP