Do you mean in the database? I generally use a timestamp field because I believe it handles time zones better than datetime (it converts to and from UTC for storage and retrieval). There are caveats though; you will need to make sure the fields are set up correctly in the database so they don’t get assigned automatically on creation or update.
See the top two answers here for more info to help your decision.
No, but you wouldn’t need to store the time, so you could just use a date field. I wouldn’t recommend either timestamp or datetime if only the date is required.
There are caveats though; you will need to make sure the fields are set up correctly in the database so they don’t get assigned automatically on creation or update.
Firstly, if you want to be able to query on dates and times easily, you should probably use one of MySQL’s native types, such as timestamp or datetime. Once you’ve done that, it should be fairly easy to construct a query to get whichever range of records that you want.
You’ll want to use the CDbExpression class to make use of MySQL’s native date processing functions when you write your Yii models.