Dateformat??????

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
terji
Forum Commoner
Posts: 37
Joined: Tue May 14, 2002 5:27 pm
Location: Denmark

Dateformat??????

Post by terji »

I have a problem with dateformats. After selecting a date from my database and displaying it, it has the wrong appearence.

My question is: How do I format my date?

This is the date returned by the database after echo: 2002-10-14 00:00:00
I want it to be displayed as: 14-10-2002

How do I format my date???
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You can format the date by using MySQL's DATE_FORMAT() function in your SELECT statement:
http://www.mysql.com/doc/en/Date_and_ti ... tions.html

PHP also has functions for playing with dates and times:
http://www.php.net/manual/en/ref.datetime.php

Mac
Post Reply