|
-
Apr 21st, 2010, 10:01 PM
#1
Thread Starter
Hyperactive Member
php5, MySQL date problem
Has anyone found anything like a tutorial anywhere on the net dealing with selection of MySQL via date.
I want to write a date to a record? (What format what field type)
I want to then be able to select records ordering by the date field.
Strangely I can't find anything on the net.
-
Apr 21st, 2010, 11:40 PM
#2
Thread Starter
Hyperactive Member
Re: php5, MySQL date problem
Ok have got this far 
SELECT * FROM table_name ORDER BY date_ent DESC LIMIT 10
NOW() seems the best bet for getting the current date time into the record
-
Apr 22nd, 2010, 01:16 AM
#3
Re: php5, MySQL date problem
you can use the DATETIME data type. the format is YYYY-MM-DD HH:MM:SS, where HH is 0-23. I don't know what else you're asking for, since you've already used ORDER BY.
NOW() is the function to use if you want a DATETIME, whereas CURDATE() would be used for just a DATE, and CURTIME() would be used for just a TIME.
-
Apr 22nd, 2010, 02:44 PM
#4
Thread Starter
Hyperactive Member
Re: php5, MySQL date problem
Should have an actual question by tomorrow when I try all this new found goodness out
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
|