convert wtime to string before calling replace