Changing date formats

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
davidjwest
Forum Commoner
Posts: 67
Joined: Sat Nov 06, 2004 5:26 am
Location: Leeds, Yorkshire, England

Changing date formats

Post by davidjwest »

I have a MySQL table with the date in it in YYYY-MM-DD format and I want to display this is DD-MM-YYY format.

What would be the easiest/best way to do this?

Is there a command in MySQL which would let me change the format in the SELECT or can I change the format once I have the date using PHP?

Or would it be easiest to insert the date into the table in the right format in the first instance - in which case is there any special command needed when the table is created?

Thanks.

I've done some searching around and the only info I can find is about the date('d-m-Y'} function which doesn't really help me.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Post Reply