# Calculating Kiddush Levana Times Using the Zmanim API

Kidush levanah times depend on the time of the molad. The time of the molad announced in shuls on Shabbos Mevarchim is the time of the Molad Emtzai (Average Molad) in Yerushalayim local mean time. This has to be converted to standard time. Standard time uses time zones to unify clock times across a large area. With 360° of longitude around the globe, the world is divided into 24 timezones (one per hour) resulting in timezones that are 15° of longitude each. Har Habayis with a longitude of 35.2354° is 5.2354° away from the 30° longitude line. Multiply the 5.235° by 4 minutes per degree (15° of longitude per hour) to reach 20.94 minutes, or 20 minutes and 56.496 seconds (5.235 * 4 = 20.94). This time is subtracted from the local molad time to arrive at Standard time. Since the time of the molad is at the same instant globally (unlike zmanim such as sunrise that depend on a person’s location), converting this to a user’s local time involves simply calculating the time difference between the time in Yerushalayim and your location. If daylight savings time is in use, this has to be added to the calculation. Java date formatting classes do this calculation on Date objects without forcing the developer to do any calculations.

## Calculating the Start and End of Kiddush Levana Times

The JewishCalendar class contains the methods for claculating these zmanim. Calculating Tchilas Zman Kiddush Levana (the earliest time Kiddush Levana can be said) is done by adding 3 days or 7 days to the molad time. Sof Zman Kiddush Levana (the latest time Kiddush Levana can be said) is either the time between molad and molad calculated by adding 14 days, 18 hours, 22 minutes and 1.666 seconds to the molad (half the 29 days, 12 hours, 44 minutes and 1 chelek (3.333 seconds)), or by adding 15 days to the molad.

## Using the Zmanim API Calculate Molad Based Times

Here is sample code for calculating various kiddush levana times for anywhere in the world for Shevat 5729 (1969). Since formatting classes requires a timezone for proper formatting, the simple code below assumes that you are looking for the time in your local timezone. If you want the time for a timezone other than the one your computer is in, set the SimpleDateFormat.setTimeZone() to the timezone you wish to display the times for.

```int year = 5729;
int month = JewishDate.SHEVAT;
Date tchilas3Days = JewishCalendar.getTchilasZmanKidushLevanah3Days(year, month);
Date tchilas7Days = JewishCalendar.getTchilasZmanKidushLevanah7Days(year, month);
Date sofZmanBetweenMoldos = JewishCalendar.getSofZmanKidushLevanahBetweenMoldos(year, month);
Date sofZmanKidushLevanah15Days = JewishCalendar.getSofZmanKidushLevanah15Days(year, month);
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy 'at' HH:mm:ss z");
System.out.println("Tchilas Zman Kiddush Levana 3 Days: " + sdf.format(tchilas3Days));
System.out.println("Tchilas Zman Kiddush Levana 7 Days: " + sdf.format(tchilas7Days));
System.out.println("Sof Zman Kiddush Levana Between Moldos: " + sdf.format(sofZmanBetweenMoldos));
System.out.println("Sof Zman Kiddush Levana 15 Days: " + sdf.format(sofZmanKidushLevanah15Days));
```

this will output the following in an EST timezone.

```Tchilas Zman Kiddush Levana 3 Days: Jan 21, 1969 at 06:06:29 EST
Tchilas Zman Kiddush Levana 7 Days: Jan 25, 1969 at 06:06:29 EST
Sof Zman Kiddush Levana Between Moldos: Feb 02, 1969 at 00:28:31 EST
Sof Zman Kiddush Levana 15 Days: Feb 02, 1969 at 06:06:29 EST
```

## Kiddush Levana Times During Daylight Hours

As you can see, all of these times are at night (After tzais 72 and prior to Alos 72 minutes in Montreal). Many times, these calculations will result in times that are during daylight hours when Kidush Levana can’t be said. When using the API and calculating the time for the tchilas zman kiddush levana and the time is during daylight hours, the earliest time should be tzais the following night. When the calculated time of sof zman kiddush levana is during daylight hours, the time posted should be alos on the previous night. The API may at some point support a method of automatically calculating this.

## 8 thoughts on “Calculating Kiddush Levana Times Using the Zmanim API”

1. f. leon says:

all very good but why not give the date and time each month ? regards

1. The Zmanim API allows you to do that easily. What exactly are you looking for that is not supported by the Zmanim API?

2. isaac Savdie says:

i am writing a hebrew calendar in fortran and would like to know if you have the detailed calculation for the last day for kiddush levana. i noticed in the dates given by http://www.frumtoronto.com/Zmanim.asp for a given month the date could be the 14th, 15th or 16th day of the hebrew month. can you please elucidate? is it the announced molad + 15 days? or + 16 days? if so would not the sof zman kidush levana be always on that day, ie 15 or 16 (depending on the method used). tnx a million!

3. Ahron Kramer says:

For the “3” days or “7” days after the Molad for Kiddush Levana, do we go by the Molad in Yerushalayim, or the local Molad?

4. Ahron Kramer says:

To be clear about my previous question, I don’t merely mean the time difference on the clocks due to time zones. I mean that the first sighting of the moon will not take place at the same moment worldwide.
Although for the purposes of when the month starts we follow Yerushalyim, but what about for Kiddush Levana? Do we follow Yerushalyim, or the local Molad?

1. Ahron,
This is a very interesting question. The generally accepted time in almost every luach is to use the time based on the molad in Yerushalayim. Note that the time announced in shul is based on local time in Yerushalayim. With the currently used standard time this has to be adjusted. That is the time used in my API. I will email you a kuntress that deals with this question in detail.

1. Gamliel,
Very nice. My guess is that you are not using my API. Your times are actually about 21 minutes off proper clock time. See my source code. Your code seems to assume that the molad time is timezone based, when in fact it is local mean time. I would suggest that since this is a practical calendar you convert the chalakim to real time. Does the UI library you use allow you to partially highlight a day? If the time starts at 11:59pm, your calendar will show that entire day.
Hatzlacha with the app.