http://www.sql.ru/forum/1192843/tip-dannyh-data-vremya-raspredelenie-na-osnovanii-raznicy-mezhdu-tekushhey-datoy-i-zadannoy