Displaying future times

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Oct 17 14:52:18 CEST 2007


On Wed, 17 Oct 2007 12:20:06 +0000, ryan k wrote:

> I have a schedule of times in the future that I want to display in a
> timezone the user sets. There is a useful module
> http://www.purecode.com/~tsatter/python/README.txt (at that URL) with a
> function that takes seconds from the epoch and a time zone and returns
> what is basically a datetime object.
> 
> My question is how to I display the seconds from the epoch for a
> datetime object (which will be a datetime in the future) for the UTC
> timezone?

Is this a trick question? Won't the answer be "The same way you would for 
a datetime in the past"?


To get the number of seconds from the epoch, see the function timegm() in 
the calendar module.



-- 
Steven.



More information about the Python-list mailing list