Printing the date for a blog

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
User avatar
jolinar
Forum Commoner
Posts: 61
Joined: Tue May 24, 2005 4:24 pm
Location: in front of computer

Printing the date for a blog

Post by jolinar »

I'm working on writing a blog at the moment that I'm having a little trouble with.

The database has 3 fields. title, content and data. The data uses the mysql datetime format. Converting the published date in to this format was simple enough. (using the data() function and concatenating the resulting strings. As a result I have a string of this format: 2006-09-17 12:09:53 (yyyy-mm-dd hh:mm:ss)

The problem is that I'd like to output the date in a more intuative format when the blog entries are outputted. (convert the day number to the name of the day, etc)

Are there any built in functions that would allow me to do this?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

MySQL has several functions that may be of interest: DATE_FORMAT() and UNIX_TIMESTAMP() come to mind first.

If you convert it to a unix timestamp, date() will then become available.
Post Reply