[SOLVED] Reformat A Date

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

yakasha
Forum Newbie
Posts: 10
Joined: Wed Aug 03, 2005 1:17 pm
Location: Las Vegas, NV
Contact:

php way

Post by yakasha »

If, in the future you really want to do it the php way, remember strtotime() can understand most dates. Including, I think, the one you have. So just:

Code: Select all

$new_date = date("d-m", strtotime($old_date));
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Re: php way

Post by hawleyjr »

yakasha wrote:If, in the future you really want to do it the php way, remember strtotime() can understand most dates. Including, I think, the one you have. So just:

Code: Select all

$new_date = date("d-m", strtotime($old_date));
Why do you say that? MySQL will do it just fine.
Post Reply