Below is code to print Date and Time parameters to a text/csv file in Jmeter
String Date = vars.get("${__time(MM/dd/yyyy,currentDate)}");
String Time = vars.get("${__time(hh:mm:ss,currentTime)}");
String Date = vars.get("currentDate");
String Time = vars.get("currentTime");
log.info(Date);
log.info(Time);
f = new FileOutputStream ("C:/[FilePath]/Timestamp.txt",true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(Date+","+Time);
f.close();