I'm having a difficulty in Django in returning the datetime at the local timezone. In Django I set USE_TZ=True
and TIME_ZONE = 'America/Sao_Paulo'
When calling timezone.now()
, return the datetime with time in utc, I do not know what the problem is.
>>> print str(timezone.now().strftime('%z'))
+0000
My goal is to format the current datetime not used by pagseguro, which is ' YYYY-MM-DDThh:mm:ss.sTZD'
', which would be ex: '2015-02-26T01:40:000-03:00'
.
How can I solve this problem in Django in relation to timezone and return formatted as the pagseguro asks for 'YYYY-MM-DDThh:mm:ss.sTZD'
?