Date formatting problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tourex
Forum Newbie
Posts: 1
Joined: Thu Oct 07, 2004 12:35 pm

Date formatting problem

Post by Tourex »

I know this must be a really easy one, but please bear with me as a total newbie.

I'm trying my first attempts with MySQL and PHP. I've defined a database table with the field UpdateDate defined as DATE. An entry for the 15 October 2004 shows correctly as 2004-10-15 when I select the table.

Now, I want to display that field as '15 Oct 2004' on my web page. It is defying my attempts to do so. I have tried the sql Date_Format function on the field in the Select command and got a blank output. When I extract the UpdateDate field from the row and try to use the php Date() command on it I get either blank output or rubbish dates.

Can anyone please help - in very simple code terms - and explain where I might be going wrong. This is driving me nuts.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Could you post the SQL you've been trying so we can try and help you sort it :)

Mac
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[mysql_man]DATE_FORMAT[/mysql_man]()
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Some helpful research links:

[big_search]php mysql date[/big_search]
Post Reply