Terry Ford wrote: > > So I'm just wondering what's considered the current best practice use of date > and time storage in mysql using CF. Timestamp? Datetime? Neither? Is > using epoch times a no-no nowadays, or do other people still use it?
For what it's worth, I use the datetime field in MySQL, PostgreSQL, and SQL Server, and my programmatical code is exactly the same for each. Just because it's more complicated to handle actual datetime objects in other languages doesn't mean I'm going to avoid using them. I DO tend to avoid the less compatible datatypes.... I never use tinyint, bit or boolean datatypes when developing apps that I need to run in multiple databases, because not all databases have them or treat them the same - the "bit" in postgresql is very handled differently from the bit in SQL Server, and the YesNo in access, and there's no equivalent in MySQL. tinyints aren't universal either so I go to smallint... the increase in storage requirements are minimal and even if you're only storing 0s and 1s I doubt there's a performance difference. Anyway, other advantages of using datetime fields instead of epoch time is the ability to use datetime functions in your database queries. I recently did a job where I used the following: group by Year(myDate), Month(myDate) to retrieve monthly data totals. Rick ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237837 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54