Fix Proper date change ordinal to datetime

+ change sql statement for easier reading