Datetime integrated with rest of code