title: defining a field for current year in web2py using datetime
body: <p>I am completely new to Web2Py and have the following problem:</p>
  
  <p>I am trying to define a database and have the current year as a field which should be automatically filled in using datetime. </p>
  
  <p>But when I try to open the database and look at the entries I get a traceback which I do not understand (see below). </p>
  
  <p>Edit: I think it has to do something with strftime having only one argument. When I am using strftime("%Y%m%d") it is working perfectly. But I really only need the current year.</p>
  
  <p>Thank you</p>
  
  <p><strong>Code</strong></p>
  
  <p>import datetime</p>
  
  <pre><code>       db.define_table('orders',            
                      Field("current_year", "string",default=datetime.datetime.now().strftime("%Y"),Label=T('Current Year'), readable=True, writable=False))
  </code></pre>
  
  <p><strong>Code using IS_DATETIME</strong></p>
  
  <p>After reading the web2py documentation I also tried this: </p>
  
  <p>import datetime</p>
  
  <p>Field('current_year', 'string', label=T('Current Year'), default=IS_DATETIME(format=T('%Y')),readable=True, writable=False))</p>
  
  <p><strong>Traceback:</strong></p>
  
  <p>Traceback (most recent call last):
    File "/home/PyCatUB/web2py/applications/contacts/controllers/appadmin.py", line 269, in select
      *fields, limitby=(start, stop))
    File "/home/PyCatUB/web2py/gluon/packages/dal/pydal/objects.py", line 2020, in select
      return adapter.select(self.query, fields, attributes)
    File "/home/PyCatUB/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", line 123, in select
      return super(SQLiteAdapter, self).select(query, fields, attributes)
    File "/home/PyCatUB/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1296, in select
      return self._select_aux(sql,fields,attributes)
    File "/home/PyCatUB/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1253, in _select_aux
      self.execute(sql)
    File "/home/PyCatUB/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1388, in execute
      return self.log_execute(*a, **b)
    File "/home/PyCatUB/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1382, in log_execute
      ret = self.get_cursor().execute(command, *a[1:], **b)
    File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 66, in convert_timestamp
      datepart, timepart = val.split(" ")
  ValueError: need more than 1 value to unpack</p>