I am creating a SQL database for holding articles online. I will have the articles queried according to the 'date_created'. In the database, 'date_created' is a TimeStamp field. Is it possible for PHP to query that field and determine the year, month, and day of each record in order to give queried results.
Basically, in user terms... A user will go to the ARCHIVE section and click on 2002. It will show the 12 months as links. Then the user will click on FEBRUARY and the next page will list all 2002 February articles (according to the query of 'date_created'
I guess another way of doing this is seperating the YEAR, MONTH, DAY into seperate fields - but that is definitely a long way. Any ideas?
Easy Question
Moderator: General Moderators
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
There are also some MySQL functions you maybe interested in:
MONTH(date)
Returns the month for date, in the range 1 to 12.
YEAR(date)
Returns the year for date, in the range 1000 to 9999.
13.5 Date and Time Functions
MONTH(date)
Returns the month for date, in the range 1 to 12.
YEAR(date)
Returns the year for date, in the range 1000 to 9999.
13.5 Date and Time Functions