How do I check if a variable contains a datetime and the format it to just include the date, hour, minutes and seconds. Not milliseconds.
The issue I'm having is that the variable isn't in datetime format as it can either contain text or a date time.
return isinstance(new_value, datetime.datetime)
Therefore running the command above returns false.
If new_value contains 2016-05-24 09:26:51.754000+00:00 how do I format it to look like this : 2016-05-24 09:26:51