|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.icu.util.Calendar
com.ghasemkiani.util.icu.PersianCalendar
This is an arithmetic implementation of the Persian Calendar (also known as the Iranian or Jalali Calendar) based on the calendar framework of ICU4J (IBM's International Components for Unicode for Java), version 3.2.
ICU4J is copyright International Business Machines Corporation (IBM).
Please see the file icu4j_3_2_license.html
included with
this software package for information about ICU4J license.
An astronomical version of the Persian Calendar may be implemented in a future release.
Usage Example
The following code snippet shows how to use the
class:
PersianCalendar
import java.util.Date; import com.ibm.icu.util.TimeZone; import com.ibm.icu.util.ULocale; import com.ibm.icu.text.DateFormat; import com.ghasemkiani.util.icu.PersianCalendar; // ... PersianCalendar pc = new PersianCalendar(TimeZone.getTimeZone("Asia/Tehran")); DateFormat df = pc.getDateTimeFormat(DateFormat.FULL, DateFormat.DEFAULT, new ULocale("fa", "IR", "")); String result = df.format(new Date()); // ...
Some possible results are shown below:
Locale | Formatted String |
---|---|
فارسی | جمعه، ۷ اسفند ۱۳۸۳ ۱۲:۰۰:۳۹ |
فارسی (افغانستان) | جمعه، ۷ حوت ۱۳۸۳ ۱۲:۰۰:۳۹ |
العربية | الجمعة, ٧ إسفند, ١٣٨٣ ١٢:٠٠:٣٩ م |
English | Friday, Esfand 7, 1383 12:00:39 PM |
Français | vendredi 7 Esfand 1383 12:00:39 |
Deutsch | Freitag, 7. Esfand 1383 12:00:39 |
Русский | 7 Эсфанд 1383 г. 12:00:39 |
Türkçe | 07 Isfend 1383 Cuma 12:00:39 |
Esperanto | vendredo, 7-a de esfando 1383 12:00:39 |
Field Summary | |
---|---|
static int |
AH
After Hijra Era. |
static int |
BH
Before Hijra Era. |
Fields inherited from class com.ibm.icu.util.Calendar |
---|
AM, AM_PM, APRIL, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DOW_LOCAL, DST_OFFSET, ERA, EXTENDED_YEAR, FEBRUARY, FRIDAY, HOUR, HOUR_OF_DAY, JANUARY, JULIAN_DAY, JULY, JUNE, MARCH, MAY, MILLISECOND, MILLISECONDS_IN_DAY, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, WEEKDAY, WEEKEND, WEEKEND_CEASE, WEEKEND_ONSET, YEAR, YEAR_WOY, ZONE_OFFSET |
Fields inherited from interface com.ghasemkiani.util.PersianCalendarConstants |
---|
ABAN, AZAR, BAHMAN, DEY, ESFAND, FARVARDIN, KHORDAD, MEHR, MORDAD, ORDIBEHESHT, SHAHRIVAR, TIR |
Constructor Summary | |
---|---|
PersianCalendar()
Constructs a Persian calendar with the default time zone and locale. |
|
PersianCalendar(java.util.Date date)
Constructs a Persian calendar with the default time zone and locale and sets its time to the specified date-time. |
|
PersianCalendar(int year,
int month,
int date)
Constructs a Persian calendar with the default time zone and locale and sets its time to the specified date. |
|
PersianCalendar(int year,
int month,
int date,
int hour,
int minute,
int second)
Constructs a Persian calendar with the default time zone and locale and sets its time to the specified time. |
|
PersianCalendar(java.util.Locale aLocale)
Constructs a Persian calendar with the default time zone and the specified locale. |
|
PersianCalendar(com.ibm.icu.util.TimeZone zone)
Constructs a Persian calendar with the specified time zone and the default locale. |
|
PersianCalendar(com.ibm.icu.util.TimeZone zone,
java.util.Locale aLocale)
Constructs a Persian calendar with the specified time zone and locale. |
|
PersianCalendar(com.ibm.icu.util.TimeZone zone,
com.ibm.icu.util.ULocale locale)
Constructs a Persian calendar with the specified time zone and locale. |
|
PersianCalendar(com.ibm.icu.util.ULocale locale)
Constructs a Persian calendar with the default time zone and the specified locale. |
Method Summary | |
---|---|
void |
add(int field,
int amount)
Adds the specified amount to the specified field of this calendar. |
java.lang.String |
getType()
Type of this calendar. |
Methods inherited from class com.ibm.icu.util.Calendar |
---|
after, before, clear, clear, clone, equals, fieldDifference, get, getActualMaximum, getActualMinimum, getAvailableLocales, getAvailableULocales, getDateTimeFormat, getDateTimeFormat, getDayOfWeekType, getDisplayName, getDisplayName, getFieldCount, getFirstDayOfWeek, getGreatestMinimum, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getLeastMaximum, getLocale, getMaximum, getMinimalDaysInFirstWeek, getMinimum, getTime, getTimeInMillis, getTimeZone, getWeekendTransition, hashCode, isEquivalentTo, isLenient, isSet, isWeekend, isWeekend, roll, roll, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int BH
public static final int AH
Constructor Detail |
---|
public PersianCalendar()
public PersianCalendar(com.ibm.icu.util.TimeZone zone)
zone
- the desired timezone.public PersianCalendar(java.util.Locale aLocale)
aLocale
- the desired locale.public PersianCalendar(com.ibm.icu.util.ULocale locale)
locale
- the desired locale.public PersianCalendar(com.ibm.icu.util.TimeZone zone, java.util.Locale aLocale)
zone
- the desired timezone.aLocale
- the desired locale.public PersianCalendar(com.ibm.icu.util.TimeZone zone, com.ibm.icu.util.ULocale locale)
zone
- the desired timezone.locale
- the desired locale.public PersianCalendar(java.util.Date date)
date
- the date of this calendar object.public PersianCalendar(int year, int month, int date)
year
- the Persian year.month
- the Persian month (zero-based).date
- the Persian day of month.public PersianCalendar(int year, int month, int date, int hour, int minute, int second)
year
- the Persian year.month
- the Persian month (zero-based).date
- the Persian day of month.hour
- the hours part of time.minute
- the minutes part of time.second
- the seconds part of time.Method Detail |
---|
public void add(int field, int amount)
add
in class com.ibm.icu.util.Calendar
field
- the field index.amount
- the amount to add.public java.lang.String getType()
Type of this calendar.
Type is used for loading resources. Since there is no calendar data for
this type ("persian"), the CalendarData
will use the fallback type
("gregorian"). This is fine, just the month names and era names must
be changed. This is taken care of by PersianDateFormatSymbols
,
which uses a java resource bundle in its turn.
getType
in class com.ibm.icu.util.Calendar
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |