[IMP]Used datetime.replace to manipulate date,improved code.