Could life be made easier by saving DateTime values as a long
instead? There always seem to be problems when working with null DateTime values, whether storing
No, use a datetime
column.
There always seem to be problems when working with null DateTime values
If your column is nullable, and you for some reason have difficulties when the type of the column is datetime
you will also have problems when the type of the column is long
.
... invalid DateTimes
How do you get invalid datetimes into a datetime
column? One of purposes of using the datetime
column to begin with is that sort of validation happens before the data is allowed to be inserted. Much more likely you'll get invalid datetimes when using a naked long
.
Finally, using a long
means that viewing your database via simple SQL (select * from table
) will produce illegible results.