com.ghasemkiani.util
Class PersianCalendarHelper

java.lang.Object
  extended bycom.ghasemkiani.util.PersianCalendarHelper

public class PersianCalendarHelper
extends java.lang.Object

This class contains algorithms for converting Julian days to the Persian calendar system, and vice versa. The algorithms have been rewritten and some bugs in the Java code have been corrected, but, originally, they have been based on the "Calendar Math Add-In for Excel" by Kees Couprie, whose contribution is gratefully acknowledged.

Version:
2.1
Author:
Ghasem Kiani

Constructor Summary
PersianCalendarHelper()
           
 
Method Summary
static boolean isLeapYear(long year)
          Determines if the specified year is a leap year in the Persian calendar.
static long jp(long j)
          Returns the date in the Persian calendar corresponding to the specified Julian day.
static long pj(long y, int m, int d)
          Returns the Julian day corresponding to the specified date in the Persian calendar.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersianCalendarHelper

public PersianCalendarHelper()
Method Detail

isLeapYear

public static boolean isLeapYear(long year)
Determines if the specified year is a leap year in the Persian calendar.

Parameters:
year - the "Persian" year.
Returns:
true if year is a leap year, false otherwise.

pj

public static long pj(long y,
                      int m,
                      int d)
Returns the Julian day corresponding to the specified date in the Persian calendar.

Parameters:
y - the Persian year.
m - the Persian month.
d - the Persian day.
Returns:
the Julian day corresponding to the specified date in the Persian calendar.

jp

public static long jp(long j)
Returns the date in the Persian calendar corresponding to the specified Julian day. The date fields (year, month, and day) are packed into a long value. See PersianCalendarUtils class for extraction of fields from the packed long value.

Parameters:
j - the Julian day.
Returns:
a packed long value containing the corresponding Persian year, month, and day.