December 2, 2008 § 2 Comments

I really miss Ruby’s, too bad Python does not have something as convenient.

So I created one:

import datetime
import time

class TimeUtil():
	def to_i(cls, t=None):
		if t is None:
			t = datetime.datetime.utcnow()
		return time.mktime(t.timetuple())

Tagged: , , ,

§ 2 Responses to Ruby’s

  • Larry Price says:

    Just out of curiosity, what does this do for you that



  • didip says:

    @ Larry Price:

    1. On my project, all time instance are in datetime format. That information is of course absent in this blog.

    2. But, to tell you the truth, somehow I just didn’t think about doing int(time.time()). Thanks for pointing that out.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

What’s this?

You are currently reading Ruby’s at RAPD.


%d bloggers like this: