הגדרות Language:

שיטה:

ספירת העומר:

ערבי חגים:

אסרו חג:

ראשוןשנישלישירביעיחמישישישישבת
1 י 2 יא 3 יב
4 יג 5 יד 6 טו 7 טז 8 יז 9 יח 10 יט
11 כ 12 כא 13 כב 14 כג 15 כד 16 כה 17 כו
18 כז 19 כח 20 כט 21 ל 22 א (תמוז) 23 ב 24 ג
25 ד 26 ה 27 ו 28 ז 29 ח 30 ט

פיד iCal

The Source Code

You may download the source code and use it on your website. (There's also a Drupal module.) It's GPLed.

The API

The most important part of the code is the JewishCalendar PHP class. It contains the 'brain' that calculates the holidays. It is derived from the base class NativeCalendar, so you should add also this to the bundle. The rest of the code, including the GUI you see here, is considered a demonstration of how to use this class and is appropriately contained in files having 'demo' in their names (e.g. 'demo.php').

Here's a taste of the API:

require_once 'NativeCalendar.php';

$jcal = NativeCalendar::factory('Jewish'); // In the future there may be Drivers
                                           // for other calendars.

$jcal->settings(array(
  'language' => CAL_LANG_NATIVE, // Speak in Hebrew, not English.
  'method'   => 'israel',        // Can be either 'israel' or 'diaspora'.
  'eves'     => TRUE,            // Give us 'Erev Rosh HaShana' too.
));

// Let's print the holidays for the next 20 days.

$timestamp = time();

for ($n = 20; $n--; ) {
  print 'Holidays for '. date('Y-m-d', $timestamp) .":\n";
  foreach ($jcal->getHolidays($timestamp) as $holiday) {
    print "   $holiday[name]\n";
  } 
  $timestamp += 60*60*24; // Advance to the next day
}

The output of this snippet is:

Holidays for 2007-09-20:
Holidays for 2007-09-21:
   ערב יום הכיפורים
Holidays for 2007-09-22:
   יום הכיפורים
Holidays for 2007-09-23:
Holidays for 2007-09-24:
Holidays for 2007-09-25:
Holidays for 2007-09-26:
   ערב סוכות
Holidays for 2007-09-27:
   סוכות
Holidays for 2007-09-28:
   חול המועד סוכות
Holidays for 2007-09-29:
   חול המועד סוכות
Holidays for 2007-09-30:
   חול המועד סוכות
Holidays for 2007-10-01:
   חול המועד סוכות
Holidays for 2007-10-02:
   חול המועד סוכות
Holidays for 2007-10-03:
   הושענא רבה
Holidays for 2007-10-04:
   שמיני עצרת
‎   שמחת תורה
Holidays for 2007-10-05:
Holidays for 2007-10-06:
Holidays for 2007-10-07:
Holidays for 2007-10-08:
Holidays for 2007-10-09:

Let's have another script...

// Print today's date:
print $jcal->getMediumDate(time()) ."\n";

// Now in English:
$jcal->settings(array('language' => CAL_LANG_FOREIGN));
print $jcal->getMediumDate(time()) ."\n";

// When did the first man land on the moon?
print $jcal->getMediumDate('1969-07-20') ."\n";

...which outputs:

ח' תשרי ה'תשס"ח
8 Tishrei, 5768
5 Av, 5729

Localization

The calendar comes speaking in two languages: Hebrew and English. But you can make it speak any other language. This is due to the fact that all English strings --month names and holiday names-- are enveloped in a special function. Mavens will recognize this as "the Gettext method of localizing strings." I chose the name 't' for this function.

In some projects you'd use various gettext tools to extract (see JewishCalendar.pot) and translate the strings, but it's actually enough to implement a simple-minded t() function in your script. Here's an example:

require 'NativeCalendar.php';

$jcal = NativeCalendar::factory('Jewish'); // In da future they may be drivers
                                           // fo otha calendars.
$jcal->settings(array(
  'language' => CAL_LANG_FOREIGN,
  'diaspora' => TRUE,
));

function t($s) {
  static $table = array(
    'Tishrei' => 'Teeshre',
    'Erev Rosh HaShana' => 'Justa little bit before da start of da year.',
    'Rosh HaShana I' => 'Da start of da year.',
    'Rosh HaShana II' => 'Anotha start of da year, man. See? There be two.',
    'Yom Kippur' => "Da 'No TV' day.",
    'Tsom Gedalya' => 'Rememba poor Gedalya, OK?',
    'Sukkot' => "You's squizin' yo' TV inside this thingy a here.",
  );
  if (isset($table[$s])) {
    return $table[$s];
  } else {
    return $s;
  }
}

// Dig dis:
print $jcal->printCal(2007, 9);