'Write a date or time to a worksheet cell.
Args:
row:         The cell row (zero indexed).
col:         The cell column (zero indexed).
date:        Date and/or time as a datetime object.
cell_format: A cell Format object.
Returns:
0:  Success.
-1: Row or column is out of worksheet bounds.'

@convert_cell_args
def write_datetime(self, row, col, date, cell_format=None):

    if self._check_dimensions(row, col):
        return (-1)
    if (self.constant_memory and (row > self.previous_row)):
        self._write_single_row(row)
    number = self._convert_date_time(date)
    if (cell_format is None):
        cell_format = self.default_date_format
    self.table[row][col] = cell_number_tuple(number, cell_format)
    return 0
