title: correctly formatting javascript date to MySQL
body: <p>I'm creating a JavaScript based calendar, using full-calendar.js as main backbone.
  So in other to insert a new <code>event</code> into a MySQL database, I have the following code snippet:</p>
  
  <pre><code>$.post("http://localhost/calendar/index.php/calendar/insert_event", 
        { 
          title  : title,
          start  : start,
          end    : end,
          allDay : allDay,
          url    : ''
        }, 
        function(answer) {
          console.log(answer);
        }
  ); 
  </code></pre>
  
  <p>the <code>start</code> and <code>end</code> dates are simply <code>Date()</code> objects:</p>
  
  <pre><code>var date = new Date();
  var d = date.getDate();
  var m = date.getMonth();
  var y = date.getFullYear();
  </code></pre>
  
  <p>in the <code>calendar.php</code> controller, I get the following output:</p>
  
  <pre><code>{"title":"lunch",
   "start":"Tue Oct 08 2013 08:00:00 GMT-0700 (Pacific Standard Time)",
   "end":"Tue Oct 08 2013 08:30:00 GMT-0700 (Pacific Standard Time)",
   "allDay":"false",
   "url":""}
  </code></pre>
  
  <p><code>start</code> and <code>end</code> are <code>DATETIME</code> Types in a MySQL table where the columns have the same type was above.
  When I do the <code>insert</code> using <code>CodeIgniter's</code> Active Record functions, it inserts to the table without further problems. However, when I look at the <code>MySQL</code> database to see the output, I see:</p>
  
  <pre><code>mysql&gt; select * from calendar_utility;
  +----+-----+-------+---------------------+---------------------+--------+
  | id | url | title | start               | end                 | allday |
  +----+-----+-------+---------------------+---------------------+--------+
  |  1 |     | lunch | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |      0 |
  +----+-----+-------+---------------------+---------------------+--------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p>How can I correct format the <code>JavaScript</code> <code>Date()</code> to insert correctly at the MySQL db?</p>