On Wed, 24 Aug 2005, mohsen ali momeni wrote:

> Hi,
> I need Add_date function for jalali calendar. This will be used in an
> open source project.

What is the Add_date function?

> An alternative can be a perfect algorithm to detect whether a year is
> leap or not.
> Is there anyone having a perfect implemetation of this function? (I

What do you mean by perfect?

  function is_leap_year () {
    $y = $this->y;
    /* 33-year cycles, it better matches Iranian rules */
    return (($y+16)%33+33)%33*8%33<8;

  function is_leap_year () {
    $y = $this->y;
    /* 2820-year cycles, idiots think it's more precise */
    return (((($y)-474)%2820+2820)%2820*31%128<31);

(from behdad.org/cal/cal.phps behdad.org/cal/)

> have checked the conversion codes (J2G,G2J) in farsiweb but it seems
> to have problems)

What problems?  We don't know of any.

> Regards,

PersianComputing mailing list

Reply via email to