title: C# Append Timestamp to Filepath
body: <p>I have the following problem or question,
  I have this function</p>
  
  <pre><code>private void SavePic(Canvas canvas, string filename)
      {
          RenderTargetBitmap renderBitmap = new RenderTargetBitmap(
           (int)canvas.Width, (int)canvas.Height,
           96d, 96d, PixelFormats.Pbgra32);
          // needed otherwise the image output is black
          canvas.Measure(new Size((int)canvas.Width, (int)canvas.Height));
          canvas.Arrange(new Rect(new Size((int)canvas.Width, (int)canvas.Height)));
  
          renderBitmap.Render(canvas);
  
          //JpegBitmapEncoder encoder = new JpegBitmapEncoder();
          PngBitmapEncoder encoder = new PngBitmapEncoder();
          encoder.Frames.Add(BitmapFrame.Create(renderBitmap));
  
          using (FileStream file = File.Create(filename))
          {
  
              encoder.Save(file);
          }
      }
  </code></pre>
  
  <p>and the corresponding call
  <code>SavePic(mySuperDefaultPainting, @"C:\KinDraw\out.png");</code></p>
  
  <p>Now I wanted to attach the file name the date + time?
  You can grab this DateTime function in the function call?</p>
  
  <p>maybe I can someone help here?</p>