Python PHP date() class

I haven’t been doing much PHP as of late, at least nothing special. I’ve been studying for my A+ Certification, working on Python/Django, and doing 3d modeling (With 3ds max), so I’ve had very little time to play around with PHP.

For Python however, I was unhappy with the date formatting functions available so I decided to write my own. It’s in the form of a class which uses PHP style date formatting with almost all of the PHP date() options (prefixed by a % though). I’ve attached the source code.

You just have to import my class, make an instance and call the desired function. Example:

from my.project.includes import pytime

pytime = PyTime()

print pytime.get_datetime(format="%l, %F %j%S, %Y at %H:%i") # Results with something similar to "Friday, June 4th, 2010 at 11:24"

Download my Python date formatting class now!

Leave a Reply