aj_nsc
01-04-2007, 09:52 AM
I'm a fairly new database programmer, I've got a few general concepts under my belt but I'm starting to become more interested in what the specific options for fields do and what can be done with them, in this case, date time.
Let's say I'm making a blog program, I want to use a field blogged which is a datetime field to keep track of when each blog was posted. I have a few questions about this:
Is this field filled in automatically every time a record is added or do I have to manually insert the value with the correct format (YYYY-MM-DD HH:MM:SS)?
Can I sort blog entries using this field directly through a MySQL query or do I have to use some other language (i.e. PHP) to abstract the information from the datetime field first and then sort them using PHP?
If I want to display rangers of blogs (say, every entry for July 2006) how would I go about doing this (you can use PHP as an example)?
If sorting the entries into groups is the main concern, is it better to use a datetime field, or a timestamp field, or is there a difference?
Thanks for fielding these questions, everyone on here is so helpful I'm sure these will be answered in no time.
Let's say I'm making a blog program, I want to use a field blogged which is a datetime field to keep track of when each blog was posted. I have a few questions about this:
Is this field filled in automatically every time a record is added or do I have to manually insert the value with the correct format (YYYY-MM-DD HH:MM:SS)?
Can I sort blog entries using this field directly through a MySQL query or do I have to use some other language (i.e. PHP) to abstract the information from the datetime field first and then sort them using PHP?
If I want to display rangers of blogs (say, every entry for July 2006) how would I go about doing this (you can use PHP as an example)?
If sorting the entries into groups is the main concern, is it better to use a datetime field, or a timestamp field, or is there a difference?
Thanks for fielding these questions, everyone on here is so helpful I'm sure these will be answered in no time.