# Save all the variable with file name containing the Time stamp [duplicate]

How to save all the variable with a filename containing the Timestamp. For example: If the current time is 2:30:56 PM, The file name should be FileName_143056.

I am currently using

Names["Global*"] (*Check they're there*)
DumpSave["G:\\Mathematica\\dump.mx", "Global"];


This worked out

out = FileNameJoin@{\$UserDocumentsDirectory,
"MathematicaOutput" <> ToString /@ Date[] <> ".mx"}
DumpSave[out, "Global"]


Source

• Have you tried anything? It is quite straightoforward with DateString and StringJoin`. – Kuba Jul 23 '18 at 13:25
• I google it, Didn't get anything related to it. Will try now using those! – kosa Jul 23 '18 at 13:26
• I tried this: StringJoin[ToString[TimeObject[][[1]][[1]]], ToString[TimeObject[][[1]][[2]]], ToString[(TimeObject[][[1]][[3]])]] – kosa Jul 23 '18 at 13:44
• Why didn;t you use DateString or the linked topic approach? I'm sorry I am confused, what is the line below 'I tried this'. And why do you say it worked out if the result does not match your request? – Kuba Jul 23 '18 at 14:06
• I removed the 'I tried this part'. I tried this, it almost worked. But finally found the answer at the link provided in the source. – kosa Jul 23 '18 at 14:09