title: Take dashes out of MYSQL date
body: <p>Here is my situation.
  I am sending records to database through php file. Then I have a date field being set with now(). It adds the date in this format: 2013-08-01</p>
  
  <p>Then I am exporting the database to a csv. It all works fine. However, I need to take the dashes out when I am exporting it to the csv. So I need it to read: 20130801</p>
  
  <p>Is there a way to do this? Here is my export to csv code:</p>
  
  <pre><code>$from = $_REQUEST['from'];
  $to = $_REQUEST['to'];
  $filename = "APGE_ELEC_" . $to;
  header('Content-Disposition: attachment; filename="'.$filename.'".csv"');
  
      $hostname = ""; //SET SERVER/HOSTNAME
      $dbusername = ""; //SET DATABASE USERNAME
      $dbname = ""; //SET DATABASE NAME
      $dbpassword = ""; //SET DATABASE USERNAME
  
  $dbhandle = mysql_connect($hostname, $dbusername, $dbpassword) 
    or die("Unable to connect to MySQL");
  
  $selected = mysql_select_db($dbname,$dbhandle) 
    or die("Could not select Data Base");
  
  //$query = "SELECT * FROM v88374 WHERE ((date &gt;= '$from') AND (date &lt;= '$to'))";
  $query = "SELECT * FROM v88374 WHERE date &gt;= DATE_FORMAT('" . $from . "', '%Y%m%d') AND date &lt;=  DATE_FORMAT('" . $to . "', '%Y%m%d')"; 
  //$query = "SELECT * FROM v88374 WHERE date &gt;= DATE_FORMAT($from) AND date &lt;=  DATE_FORMAT($to)";
  
  $export = mysql_query ($query ) or die ( "Sql error : " . mysql_error( ) );
  
  $fields = mysql_num_fields ( $export );
  
  for ( $i = 0; $i &lt; $fields; $i++ )
  {
      $header .= mysql_field_name( $export , $i ) ."|" . "\t";
  }
  
  while( $row = mysql_fetch_row( $export ) )
  {
      $line = '';
      foreach( $row as $value )
      {                                            
          if ( ( !isset( $value ) ) || ( $value == "" ) )
          {
              $value = "\t";
          }
          else
          {
              $value = str_replace( '"' , '""' , $value );
              $value = $value . '|' . "\t";
          }
          $line .= $value;
      }
      $data .= trim( $line ) . "\n";
  }
  $data = str_replace( "\r" , "" , $data );
  
  if ( $data == "" )
  {
      $data = "\n(0) Records Found!\n"; 
  
  }
  
  print "$header\n$data";
  
  
  exit();
  </code></pre>
  
  <p>The $to and $from are parameters for searching for date range in the database. So we can leave that alone.</p>