Docs - Quickstart - Our First Strategy:

def log(self, txt, dt=None): ''' Logging function for this strategy''' dt = dt or self.datas[0].datetime.date(0) print('%s, %s' % (dt.isoformat(), txt))

Also bt has two functions to convert date to/from numbers: date2num and num2date.