When I am using a Python object, I get:
This is not the format I need. We need to convert to this data format:
How can I convert this in Python/Django?
datetime.datetime.strptime('2018-05-18 10:05:06', "%Y-%m-%d %H:%M:%S")
It’s working fine, but how can I pass 2018-05-18 10:05:06 as database but database giving?
infoDevice = Device.objects.get(user_id=user.id) newDate = Device.last_notification_time
It’s giving 2018-05-18 08:38:58+00:00.
How can I check date as per 2018-05-18 08:38:58?
Now I have implemented code for Python changes. Now it’s working. We need to just change the time setting.
Get any date from the database and change as required.
newDateFor = str(info.dbdatetime) new_dt = newDateFor.split('+') newDate = datetime.datetime.strptime(new_dt, "%Y-%m-%d %H:%M:%S") a = datetime.datetime.now().replace(microsecond=0) b = newDate
Implement any other functionality as per changes.