Refactor low level datetime functions
Fix subtraction between datetime and timedelta types
Remove unneeded datetime code