Page 1 of 1

Printing the date for a blog

Posted: Sun Sep 17, 2006 9:19 am
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?

Posted: Sun Sep 17, 2006 9:30 am
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.