Displaying future times

R

ryan k

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?
 
S

Steven D'Aprano

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.
 
R

ryan k

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.

Not a trick question at all... Cheers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top