Changed record.time to be in DATETIME format rather than timestamp