helper function to generate time string
helper function to generate time string