refactoring - further generalizing datetime conversions into a couple conversion functions