title: MySQL : STR_TO_DATE function giving null on correct output with format
body: <p>I'm trying to convert string to date in <code>mysql</code>. Inspite of giving correct string and format specifier, <code>mysql</code> is giving <code>NULL</code> output with warning message as <code>Incorrect datetime value: 'XXXXX' for function str_to_date</code> although it is working for full date string.</p>
  
  <p><strong>mysql logs</strong></p>
  
  <pre><code>mysql&gt; SELECT STR_TO_DATE('2018/06', '%Y/%m');
  +---------------------------------+
  | STR_TO_DATE('2018/06', '%Y/%m') |
  +---------------------------------+
  | NULL                            |
  +---------------------------------+
  1 row in set, 1 warning (0.00 sec)
  
  
  mysql&gt; SELECT STR_TO_DATE('2018/06/01', '%Y/%m/%d');                                                                                                                                                            +---------------------------------------+
  | STR_TO_DATE('2018/06/01', '%Y/%m/%d') |
  +---------------------------------------+
  | 2018-06-01                            |
  +---------------------------------------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p><strong>debug info</strong></p>
  
  <p>MySQL version - <code>5.7.21 MySQL Community Server (GPL)</code></p>
  
  <pre><code>mysql&gt; show warnings;
  +---------+------+--------------------------------------------------------------+
  | Level   | Code | Message                                                      |
  +---------+------+--------------------------------------------------------------+
  | Warning | 1411 | Incorrect datetime value: '2018/06' for function str_to_date |
  +---------+------+--------------------------------------------------------------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p><em>Requirement</em></p>
  
  <p>I want to parse month and year from above date string. </p>