Easily Create a Timestamped Filename in .NET

Eric says crazy filename parsing is something else you should stop doing.  If you’re creating output files, you probably need to timestamp the file name to keep the files separate.  Step away from the keyboard before you do anything crazy–you can do this in one line of VB.NET:




Dim _filename As String = String.Format(“MyFile.{0}.xml”, Now.ToString(“yyyyMMddHHmm”))