Date Format

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

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

Post by feyd »

wtf wrote:
I have a date stored in a database in this format ("m-d-Y"). I want to print out the date in a table but only showing the month and day ex: ("m-d").

Code: Select all

...DATE_FORMAT(date_assigned, '%m-%d') AS date_assigned...
will format date as you want it. It's already a part of your sql statement, therefore $row['date_assigned'] will come out in the format you want.
FYI, m-d-Y is not a MySQL date format, so the field is not a DATE type.
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Thank You

Post by icesolid »

Thank you feyd for explaining! :D
Post Reply