I have various functions that export Excel and text files, and need to have them named with a name based on the content of some variables in the function and the time and date. How can this be done with Mathematica?

If you want to have the date in a more readable and less detailed form, you could use this for the name:

"file-" <> Riffle[ToString /@ Date[][[;;3]], "-"] <> ".pdf"

file-2012-5-19.pdf

And of course, the content of any other variable could be inserted in the file name using ToString if needed. If you need a different separator between the data components, the Riffle command can be modified accordingly, by changing the second argument to another string that is allowed in filenames on your platform.

The FileNameJoin command is only needed if you'd like to create not just file names but directory structures in a cross-platform fashion.

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.