I have some doubts in the dateformat Tue Feb 25 2014 00:00:00 GMT+0530 (IST)
.
- does
Tue Feb 25 2014 00:00:00
meansGMT
orIST
- Is it possible to convert this into python
datetime
. - and also is it possible convert it into format
DD-MM-YY,HH:MM:SS
in GMT.
Here is what i tried to convert into python datetime
::
but i got error,when i tried with %z
:
>>> time_format="%a %b %d %Y %H:%M:%S GMT%z (%Z)"
>>> v="Tue Feb 25 2014 00:00:00 GMT+0530 (IST)"
>>> mydate=datetime.strptime(v,time_format)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/_strptime.py", line 317, in _strptime
(bad_directive, format))
ValueError: 'z' is a bad directive in format '%a %b %d %Y %H:%M:%S GMT%z (%Z)'
But this works:
>>> time_format="%a %b %d %Y %H:%M:%S GMT (%Z)"
>>> v="Tue Feb 25 2014 00:00:00 GMT (IST)"
>>> datetime.strptime(v,time_format)
datetime.datetime(2014, 2, 25, 0, 0)
but still didn't understand anything about TIMEZONE
.