pyfdate

download

Epydoc docs

Pydoc docs

tutorial

ferg.org home



Creative Commons Licence

This work is licensed under the Creative Commons Attribution 2.0 License You are free to copy, distribute, and display the work, to make derivative works, and to make commercial use of the work. If you do, you must give the original author credit.

Locations of visitors to this page

What is pyfdate?

Given Python's goal to be a powerful and easy-to-use scripting language, its features for working with dates and times are not as user-friendly as they should be. The purpose of pyfdate is to remedy that situation by providing features for working with dates and times that are as powerful and easy-to-use as the rest of Python.

Pyfdate doesn't attempt to be all things to all people: rather, its goal is to make it easy to do 95% if the things that people want to do with dates and times.

Pyfdate provides two classes:

  • Time — A specific point in time, identified by year, month, day, hour, minute, second. Provides easy-to-use date/time arithmetic and date/time formatting functions. (Python's datetime module calls this a "datetime".)
  • Period — An amount of time. (Python's datetime module calls this a "timedelta".)
It also provides a routine called numsplit that helps parse strings containing dates expressed in numeric formats.

What kinds of things does pyfdate not do?

  • The smallest unit of time that Pyfdate can handle is a second. It cannot be used to work with hundredths or thousandths of seconds.
  • Pyfdate knows how to do date arithmetic, and it knows what the system date is, but beyond the date that it gets from the system it doesn't know anything about timezones or daylight savings time.

International Language Support

One of pyfdate's goals is to support languages other than American English.

When it is imported, pyfdate tries to import another file called pyfdate_local.py. If pyfdate_local.py is not available, the language for displaying dates and times (e.g. weekday names and month names) is American English. If pyfdate_local.py is available, the language for displaying dates and times is taken from that file.

Local files are available for a number of languages. For example: pyfdate_local_francais.py for French, pyfdate_local_deutsch.py for German, etc.

To use the file for language <language>, simply copy pyfdate_local_<language>.py to pyfdate_local.py. And of course, you may customize pyfdate_local.py for any language of your choice.

When Python 3 is released, all code will be in Unicode, and pyfdate's international language support should improve.

In the mean time, if you make improvements to one of pyfdate's language modules (or create a new one) and wish to share it with others, send it to me and I will post it here.

How to download and install pyfdate

See the download page.

Where is pyfdate documentation?

There is Epydoc documentation and Pydoc documentation

How do I use pyfdate?

See the tutorial page.

What is pyfdate's status?

Pyfdate is still in beta status. Once pyfdate is shaken down a bit, if people find it useful enough, I will put it into a SourceForge project.

Disclaimer

We have done our best to provide bug-free software and documentation, but nobody is perfect so (cue the usual legal disclaimers): use at your own risk; we're not responsible if the software malfunctions, your hard disk crashes, the dog eats your homework, or the sky falls, etc. etc. On the other hand, if you find a bug and report it, we'll try to fix it ASAP.

Contact Information

For bug reports, enhancement suggestions, etc. contact Stephen Ferg.