Python PHP date() class

04 Jun
June 4, 2010

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!

Tags: , , , , , ,
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>