Re: days since epoch

2006-02-17 Thread Marius Gedminas
The datetime module is usually more convenient for date/time arithmetic. However in your particular case, you may find the time.time() function convenient. It returns the number of seconds since the epoch. To get the number of days divide the number of seconds by 86400. -- http://mail.python.o

Re: days since epoch

2006-02-17 Thread [EMAIL PROTECTED]
As suggested by Alex the datetime module makes this easy: py> import datetime py> epoch = datetime.datetime.utcfromtimestamp(0) py> print epoch 1970-01-01 00:00:00 py> today = datetime.datetime.today() py> d = today - epoch py> print d 13196 days, 9:50:44.266200 py> print d.days # timedelta object

days since epoch

2006-02-17 Thread eight02645999
hi how can i get the number of days since epoch using the time module? or do i have to manually do the arithmetic? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: days since epoch

2006-02-16 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > hi > how can i get the number of days since epoch using the time module? > or do i have to manually do the arithmetic? Try the datetime module -- better suited to computing days, than the time module, IMHO. Alex -- http://mail.python.org/mailman/