amirmehdizadeh / JalaliCalendar

Apache License 2.0
84 stars 46 forks source link

report bug #7

Open MehranKH opened 10 years ago

MehranKH commented 10 years ago

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

ghost commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

I changed the YearMonthDate.toString code to:

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

tahakhozooie commented 7 years ago

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