title: Append date to filename before copy in php
body: <p>I am trying to append date to the file name before copying in PHP.</p>
  
  <pre><code>$fileS = "file.csv";
  $date = date('m-d-Y H:i:s A e');
  $fileD = "file$date.csv";
  </code></pre>
  
  <p>I have even tried </p>
  
  <pre><code>$fileD = "file"."date('m-d-Y H:i:s A e')".".csv";
  </code></pre>
  
  <p>Then I copy the files</p>
  
  <pre><code>$Confirm = copy($fileS, $fileD);
  </code></pre>
  
  <p>I know I should check if the file exists etc etc but for the sake of simplicity to ask the question I am using this :).</p>
  
  <p>I am assuming it's something to do with the copy function that doesn't read concatenated strings. I may be wrong here.</p>
  
  <p>Any help with this is great appreciated.</p>
  
  <p>EDIT: The colon seems to be the problem not the $fileD. Any type of concatenation would work. (Thanks to Greenisha). </p>
  
  <p>This one works but any ideas to make it work with the colon. It seems weird to have the time with '-' instead of ':'.</p>
  
  <pre><code>$date = date('m-d-Y H-i-s A e');
  </code></pre>
  
  <p>Never mind. Colons are not allowed in the file naming convention in windows. Overlooked that part. Thanks Michael.</p>
  
  <p>I am creating this in windows now but when it goes to production it will be in in UNIX. So will the colon work there if I change it? Any suggestion will be useful down the road. Thanks for your help. </p>