date formatting Issue

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
ericsodt
Forum Commoner
Posts: 51
Joined: Fri Aug 22, 2003 12:12 pm
Location: VA

date formatting Issue

Post by ericsodt »

Hey I am grabbing the date from my database and then displaying it on the screen, however it comes back at 2003-12-07 00:00:00. How do I change that so it displays like 12-07-2003 or 12/07/2003. Thanks
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

DATE_FORMAT(). You can use that in a query.

-Nay
ericsodt
Forum Commoner
Posts: 51
Joined: Fri Aug 22, 2003 12:12 pm
Location: VA

Post by ericsodt »

I am using Access right now for the time being... so mySQL functions wont workin the query. Do you have any other thoughts about fomatting it on the page, other than switch to mySQL, which I eventually will do.


Nay wrote:DATE_FORMAT(). You can use that in a query.

-Nay
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

In that case, create a function that will do this conversion for you. Use [php_man]explode[/php_man]() to extract each piece of data. And get the date into an array where you can easily control how to print each element.
ericsodt
Forum Commoner
Posts: 51
Joined: Fri Aug 22, 2003 12:12 pm
Location: VA

Post by ericsodt »

Done, thanks :D
Sami wrote:In that case, create a function that will do this conversion for you. Use [php_man]explode[/php_man]() to extract each piece of data. And get the date into an array where you can easily control how to print each element.
Post Reply