Correctly write task completion time to db.