Changing Format

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
imatrox05
Forum Newbie
Posts: 16
Joined: Wed Mar 29, 2006 8:44 pm

Changing Format

Post by imatrox05 »

i have a simple query.

I am extracting data from a database and creating a report. The date in the database is stored in the format YYYY-MM-DD HH:MM:SS but when i display the report i just want the date to be displayed as MM/DD
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

MySQL has DATE_FORMAT()
imatrox05
Forum Newbie
Posts: 16
Joined: Wed Mar 29, 2006 8:44 pm

Post by imatrox05 »

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

Post by feyd »

strtotime() or parse it yourself, possibly with some clever explode() calls.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

imatrox05 wrote:Any PHP solution?
It will cost less overhead to let the DB server format your date.
imatrox05
Forum Newbie
Posts: 16
Joined: Wed Mar 29, 2006 8:44 pm

Post by imatrox05 »

Oh Thank You
Post Reply