Formatting the way a stored date displays...

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

Post Reply
michlcamp
Forum Commoner
Posts: 78
Joined: Mon Jul 18, 2005 11:06 pm

Formatting the way a stored date displays...

Post by michlcamp »

I have a form field ('date') that stores the date in a table as : '02-19-2006'

(These are future calendar dates that make up an "Upcoming Events" page...)

I need to display it on the output page as: 'Saturday February 19, 2006'

but still want to sort the query output using 'ORDER BY 'date'

how to?

Thanks in advance.
mc
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

$date = $row['date'];
$timestamp = strtotime($date);
$newDate = date($timestamp,"date format string here");
Although I believe there is a date format function... in MySQL. I forget the name of it. :(
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
michlcamp
Forum Commoner
Posts: 78
Joined: Mon Jul 18, 2005 11:06 pm

Post by michlcamp »

thanks. found a way.
solved.
Post Reply