johnrb87 Posted August 8, 2010 Share Posted August 8, 2010 Hi all I have a PHP script with the following var print $date; at the moment it is formatting the date like 03-24-2010 is it possible to get PHP to switch the date and month, so it looks like 24-03-2010 Thanks Quote Link to comment Share on other sites More sharing options...
kla0005 Posted August 8, 2010 Share Posted August 8, 2010 $date = date("d-m-Y"); Like that? Quote Link to comment Share on other sites More sharing options...
johnrb87 Posted August 8, 2010 Author Share Posted August 8, 2010 that just seems to print todays date Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 8, 2010 Share Posted August 8, 2010 You swap the month with days like so list($month, $day, $year) = explode('-', $date); $new_date = "$day-$month-$year"; print $new_date; Alternatively your can format the date to 24th March 2010 using this $new_date = date('jS F Y', strtotime($date)); print $new_date; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.