1
Did you print it? If you print a datetime object, it is serialized to a string but it is a datetime. You can use it as any other datetime.
0
You are seeing that because you did not set the correct time zone. Use the UTC time and then you can format .strftime("format")
the time accordingly to each locale, you can install pytz
and enable it in the settings to handle all the hustle. Always use UTC datetime object because then you can get what ever time you want knowing the zone your user is in. Documentation from Django
- [Answer]-Django: concatinating strings to create a url to static image in template
- [Answer]-Email.send() taking forever for manual connection
- [Answer]-Django session data obtainable from models.py without key
- [Answer]-"invalid literal for int() with base 10:'username'"
- [Answer]-Python, Django – private media streaming and prevent hijacking
Source:stackexchange.com