improved method for inputting date and time