public class JalaliDate extends Object
This class holds some data about specific date in Jalali's Date format like year, month, day, day of week and leap year
| Modifier | Constructor and Description |
|---|---|
protected |
JalaliDate()
Only DateConverter is allowed to create an object of JalaliDate with empty constructor's argument
|
|
JalaliDate(int year,
int month,
int day)
creates an object of jalali date.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Checks if this date is equal to another date.
|
String |
format(JalaliDateFormatter jalaliDateFormatter)
reformats jalali date with provided format.
|
int |
getDay() |
DayOfWeekPersian |
getDayOfWeek()
gets current day of week
|
MonthPersian |
getMonthPersian() |
int |
getYear() |
boolean |
isLeapYear() |
protected void |
setDay(int day) |
protected void |
setDayOfWeekPersian(DayOfWeekPersian dayOfWeekPersian) |
protected void |
setLeapYear(boolean leapYear) |
protected void |
setMonthPersian(MonthPersian monthPersian) |
protected void |
setYear(int year)
set year of jalali date and then checks is it a leap year or not.
|
String |
toString()
Transforms date to ISO-8601 standard contains year, month and day
|
protected JalaliDate()
Other classes and methods must use another version.
public JalaliDate(int year,
int month,
int day)
year - jalali yearmonth - from 1 to 12day - from 1 to 31IllegalArgumentException - if values are negative.IllegalArgumentException - if requested date is not possible.public String format(JalaliDateFormatter jalaliDateFormatter)
jalaliDateFormatter - an object that shows preferred format for jalali date.public String toString()
public int getYear()
protected void setYear(int year)
Note: only classes of this package needs this method, you'll never need it. use constructor instead.
year - input yearpublic DayOfWeekPersian getDayOfWeek()
public MonthPersian getMonthPersian()
protected void setMonthPersian(MonthPersian monthPersian)
public int getDay()
protected void setDay(int day)
public boolean isLeapYear()
protected void setLeapYear(boolean leapYear)
protected void setDayOfWeekPersian(DayOfWeekPersian dayOfWeekPersian)
public boolean equals(Object obj)
Compares this JalaliDate with another for ensuring that the date is the same.
Only object type of JalaliDate are compared, other types return false.
Copyright © 2018. All rights reserved.