time to text conversion function