|
-
Jan 12th, 2010, 09:39 PM
#4
Re: Good tutorial on date/time?
if you can design this, I would suggest using the Unix timestamp. I prefer using this method for all dates because of its ease of use with PHP and the native PHP date functions. a Unix timestamp is the number of seconds since the Epoch (1970), and so is an int type with 11 digits. you can make an 11 or 12 length int field for safety!
for an SQL query to get the last 10 articles, you can simply add the LIMIT clause, and you can also add an ORDER BY clause to sort by the date (descending). for example:
if this was your regular SQL query:
SELECT * FROM table;
then you could add the following:
SELECT * FROM table ORDER BY date DESC LIMIT 10;
that should achieve what you're trying to do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|