On Tue, May 4, 2010 at 4:22 PM, vishwajeet singh <dextrou...@gmail.com>wrote:
> > On Tue, May 4, 2010 at 4:17 PM, Abhishek Mishra <ideam...@gmail.com>wrote: > >> %Z stands for time zone name in letters Eg. IST or EDT or GMT, so it would >> fail to parse +05:30 >> >> Ahh...ok thanks for pointing that out but this is kind of stranges as I > am using same format to convert than why it's not converting it in IST ? > > Interestingly, I guess the timezone environment variable is not set on my system . >>> datetime.today() datetime.datetime(2010, 5, 4, 16, 25, 28, 381390) >>> d = datetime.today() >>> string_date = d.strftime("%a, %d %b %Y %H:%M:%S %Z") >>> string_date 'Tue, 04 May 2010 16:25:32 ' >>> ^^ notice absence of time zone An interesting discussion on same issue - http://old.nabble.com/strptime-and-timezones-td18967515.html >>> import time >>> time.tzname ('IST', 'IST')
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor