title: Using a trigger to change the date format
body: <p>I have a DB with times. The format is this: <code>30/09/2014 9:00:00</code>.</p>
  
  <p>The field is in string format and I don't want change it if it's possible.</p>
  
  <p>I need to change the mask when I do the inserts because I need this format: <code>30/09/2014 09:00:00</code>.</p>
  
  <p>The command to change a mask in a string is this:</p>
  
  <pre><code>UPDATE fichajes set tiempo=STR_TO_DATE("30/09/2014 9:00:00", '%d/%m/%Y %H:%i');  
  </code></pre>
  
  <p>I suppose I need a trigger to change the mask, but I don't know how to use it. I do something like this:</p>
  
  <pre><code>CREATE TRIGGER fichajes AFTER INSERT ON fichajes
  FOR EACH ROW BEGIN
  DECLARE fecha VARCHAR(50);
  SET fecha =(SELECT fecha from fichajes);
  UPDATE fichajes set fecha=STR_TO_DATE(@fecha, '%d/%m/%Y %H:%i');
  END;
  </code></pre>
  
  <p>This does not work and I don't know of how to work with triggers. Any help would be much appreciated.</p>