now = datetime.datetime.now() now = now.replace(hour=23, minute=59, second=59, microsecond=999999) now = now.strftime("%Y-%m-%d %H:%M:%S")