title: CakePHP Save Date/Time on Login
body: <p>I have the bellow login function in my controller and am trying to save the login date/time into the users database table under the field last_login  that is a DATETIME field, login works fine but the field never gets populated.. any ideas on what may be stopping this or how to troubleshoot what should be getting output?</p>
  
  <pre><code>public function login() {
      $this-&gt;layout = 'login';
      if ($this-&gt;request-&gt;is('post')) {
          if ($this-&gt;Auth-&gt;login()) {
  
              $this-&gt;User-&gt;id = $this-&gt;Auth-&gt;user('id'); // target correct record
              $this-&gt;User-&gt;saveField('last_login', date(DATE_ATOM)); // save login time
  
              $this-&gt;redirect($this-&gt;Auth-&gt;redirect());
          } else {
              $this-&gt;Session-&gt;setFlash('Invalid username or password, try again', 'default', array('class' =&gt; 'warning'));
          }
      }
  </code></pre>