[UPHPU] Why do forums use Int(11) for dates?
digitalsuicide at gmail.com
Wed Apr 12 14:04:30 MDT 2006
Ray Hunter wrote:
>personally, i think this is bad db design as you are putting a date value in a
>integer data type. timestamps are okay to use and you can store them in a
>timestamp data type that will do the job fine. Unless there is some other
>pressing design here like really watching the amount of space that each data
>type is using then i would recommend using the proper data type for it. this
>will also all you to use the database's built in date functions on that field.
>or instead of having php format the date you could do it in the database.
I'm going to have to partially agree. It depends on what exactly you're
designing. If it's a critical, SQL compliant database, you're going to
want to hand the processing of dates to the database and keep it as a
DATE field. However, if you're doing something fairly spurious (like a
forum), storing dates as an integer value gives you a bit more
flexibility (huzzah for SQLite!).
More information about the UPHPU