Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report bug #7

Open
MehranKH opened this issue Apr 6, 2014 · 4 comments
Open

report bug #7

MehranKH opened this issue Apr 6, 2014 · 4 comments

Comments

@MehranKH
Copy link

MehranKH commented Apr 6, 2014

JalaliCalendar.YearMonthDate yearMonthDate = JalaliCalendar.gregorianToJalali(new JalaliCalendar.YearMonthDate(2014,3,20));
System.out.println(yearMonthDate.toString());
//1393/0/31

@ghost
Copy link

ghost commented Apr 6, 2014

The month is 0-based. So if you want to convert 2014/3/20 to jalali you must say YearMonthDate(2014,3-1,20) and in return you shoud have 1392/11/29 which means 1392/12/29(29 Esfand 1392).
Enjoy coding.

@ghost
Copy link

ghost commented Apr 6, 2014

Use this link to convert dates. Tabdil,and pay attention that returned value also uses 0-based month. (2013,5-1,20)-->(1392,2-1,30)

@afattahi54
Copy link

I changed the YearMonthDate.toString code to:

public String toString() {
return getYear() + "/" + (getMonth()+1) + "/" + getDate();
}

@tahakhozooie
Copy link

tahakhozooie commented Jun 13, 2017

I edited this code in class ( JalaliCalender >> toString(); ) and this worked and shown 2017-03-04>>>1396/12/14.

code:

public String toString() {
if (getMonth() == 0){
return getYear() + "/" + "12" + "/" + getDay();
} else {
return getYear() + "/" + getMonth() + "/" + getDay();
}
}

Good luck
(+98)9305939816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants