Khayyam

A Persian Date & Time (aka: Jalali Calendar) library with timezone, DST (daylight-saving), full formatting & parsing support for python 2.x & 3.x.

http://img.shields.io/pypi/v/khayyam.svg Requirements Status https://travis-ci.org/pylover/khayyam.svg?branch=master https://coveralls.io/repos/github/pylover/khayyam/badge.svg?branch=master https://img.shields.io/badge/license-GPLv3-brightgreen.svg https://img.shields.io/github/forks/pylover/khayyam.svg?style=social&label=Fork https://img.shields.io/github/stars/pylover/khayyam.svg?style=social&label=Star

The khayyam module supplies classes for manipulating persian dates and times in both simple and complex ways. While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation.

Currently both versions of python(2.x & 3.x) are supported.

As of the python’s official documentation: There are two kinds of date and time objects: “naive” and “aware”.

An aware object has sufficient knowledge of applicable algorithmic and political time adjustments, such as time zone and daylight saving time information, to locate itself relative to other aware objects. An aware object is used to represent a specific moment in time that is not open to interpretation.

A naive object does not contain enough information to unambiguously locate itself relative to other date/time objects. Whether a naive object represents Coordinated Universal Time (UTC), local time, or time in some other timezone is purely up to the program, just like it’s up to the program whether a particular number represents metres, miles, or mass. Naive objects are easy to understand and to work with, at the cost of ignoring some aspects of reality.

For applications requiring aware objects, khayyam.JalaliDate and khayyam.JalaliDatetime objects have an optional time zone information attribute, tzinfo, that can be set to an instance of a subclass of the abstract datetime.tzinfo class, such as khayyam.Timezone and or khayyam.TehranTimezone.

The package’s API is considered to be exactly the same as the datetime module, so if you are familiar with the datetime, you can read the Migration from python’s builtin datetime.

Indices and tables