MATLAB: Diary file with current date and time as time stamp

diary function

I've used the diary command for years, but would now like to make the filename time specific depending on the current date and current time. How can I do that? I tried searching for this answer but couldn't seem to find anything.
Something like 9-13-2016-1529.txt
When I try to make a string out of the date (and call it say dfile) and type in diary dfile, it just creates a file called dfile.

Best Answer

dfile=[datestr(now,'mm-dd-yyyy'),'-1529.txt'];
diary(dfile);