Jump to content

SELECT (wanna change date format)


Recommended Posts

Call me dumb, call me stupid. Go ahead, make my day.

 

I know how to do this, I just have a brain that loses cells often. As Homer once said, \"I don\'t wanna take an Adult Ed class Marge, coz everytime I learn something new, it pushes something old out of my brain. Like the time I took a wine tasting class and forgot how to drive\".

 

Anyway, as we all know (and love) that with mySQL, the DATE format is in YYY-MM-DD. YAY!

 

I have an $sql query:

[php:1:83022e15d7]

$sql=\"SELECT * FROM `table` WHERE 1 AND `category` = \'wateva\' ORDER BY \'date\'\";

[/php:1:83022e15d7]

Now, I want that to display, DD-MM-YYYY.

 

Yet again, call me dumb and stupid, how do I do that?

 

Thanks,

 

Liam Geteu.

Link to comment
https://forums.phpfreaks.com/topic/148-select-wanna-change-date-format/
Share on other sites

have a look down the page at DATE_FORMAT

http://www.mysql.com/doc/en/Date_and_time_..._functions.html

if you use this you will have to name your columns instead of using *

 

if you prefer to do it afterwards in php - use the date() function in php - check www.php.net

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.