Date Display

Hello, I am pulling a start date and an end date from mysql and I would like for it to be mm/dd/yyyy. Right now it is showing like this:
2008-09-13- 2008-09-14
How would I be able to change this and where would I have to change the code. I pull both of these by calling <?PHP echo"$row_events['start']";?>-<?PHP echo""$row_events['end']"; ?>

Thank you for helping me to know where to change code for this.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

try this
<?PHP echo date('m-d-Y',$row_events['start']);?>-<?PHP echo date('m-d-Y',$row_events['end']); ?>

Open in new window

pertrai1Author Commented:
HuyBD, I tried this and it is showing the date as 12-31-1969? when that is not the date in the database. I have the fields start and end set in the database as date fields. Am I doing something wrong?

try this

<?php list($startyear, $startmonth, $startday) = split( '-' , $row_events['start'] );
$eventstart_date = "$startmonth-$startday-$startyear";
echo $eventstart_date;
<?php list($endyear, $endmonth, $endday) = split( '-' , $row_events['end'] );
$eventend_date = "$endmonth-$endday-$endyear";
echo $eventend_date;

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.