Open MehranKH opened 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.
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)
I changed the YearMonthDate.toString code to:
public String toString() { return getYear() + "/" + (getMonth()+1) + "/" + getDate(); }
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
JalaliCalendar.YearMonthDate yearMonthDate = JalaliCalendar.gregorianToJalali(new JalaliCalendar.YearMonthDate(2014,3,20)); System.out.println(yearMonthDate.toString()); //1393/0/31