How to convert "Tue Feb 25 2014 00:00:00 GMT+0530 (IST)" to python datetime object? -


i have doubts in dateformat tue feb 25 2014 00:00:00 gmt+0530 (ist).

  • does tue feb 25 2014 00:00:00 means gmt or ist
  • is possible convert python datetime.
  • and possible convert format dd-mm-yy,hh:mm:ss in gmt.

here tried convert python datetime::

but got error,when tried %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' bad directive in format '%a %b %d %y %h:%m:%s gmt%z (%z)' 

but 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 timezone.

in system terminal

easy_install python-dateutil 

in python shell

from dateutil import parser date_parser print date_parser.parse("tue feb 25 2014 00:00:00 gmt+0530 (ist)") 

dateutil's parse can typically parse throw @ python datetime.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -