date string into numbers refactored