I'm not selling this idea, but I'm really not selling the idea of ββstoring dates (which are not time points) as a timestamp, so here is my suggestion.
Convert the date to a human-readable integer (e.g. 2014-11-3 will become 20141103 ) and store this integer value. It contains exactly the data you need, is easy to create and analyze, and takes up minimal space. In addition, it is ordered and has an unambiguous comparison of dates with valid values ββ(provided, invalid numbers are possible, for example 20149999 , but they are easy to detect). In contrast, there are approximately 86,400 valid timestamps that represent each day.
NB: There is a discussion in DBA SE criticizing this method of storing dates, but in this context there is a specialized type of date, which is obviously not the case here.
source share