On Wed, Feb 17, 2010 at 12:44:02PM -0600, David Perlman wrote: >I have been really scratching my head over this, it seems like there >*should* be a nice easy way to do what I want but I can't find it for >the life of me. ... >But a) I don't know how to stick the offset info into a datetime >object, and the documentation doesn't seem to say anything about >this; and b) the offset line doesn't work anyway:
I think that you need to push in a tzinfo object, rather than a value: http://docs.python.org/library/datetime.html#datetime.tzinfo I get that from here: For applications requiring more, datetime and time objects have an optional time zone information member, tzinfo, that can contain an instance of a subclass of the abstract tzinfo class. These tzinfo objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that no concrete tzinfo classes are supplied by the datetime module. Supporting timezones at whatever level of detail is required is up to the application. The rules for time adjustment across the world are more political than rational, and there is no standard suitable for every application.[1] I suspect that it'll take some fooling around to see how it works though - use the interpreter or ipython to test things out. [1] http://docs.python.org/library/datetime.html -- yours, William _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor