views:

70

answers:

1

I need to parse a date/time string from user input, and convert to UTC based on timzeone info not available in the string for datetime.strptime() (any suggestions?). Is there a straightforward way of doing this?

Ideally, on google app engine i'd like to grab local time with tzinfo from the browser if possible also.

timezone_string = "GMT-0800"
fields = ("eventstartmonth","eventstartday", "eventstartyear", "eventstarttimehour", "eventstarttimeampm") 
date_string = '_'.join(map(lambda x: self.request.get(x), fields))
# date_string = "01_11_2000_1:35_PM"

dt = datetime.datetime.strptime(date_string, "%m_%d_%Y_%I:%M_%p")
# how to convert dt into a tz-aware datetime, and then to UTC