Added function to generate datetime strings