I want to use persian date in my android App im using this Library
But i have problem with formating date for example
SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd");
Calendar calendar = new GregorianCalendar(2017,9,14);
System.out.println(sdf.format(calendar.getTime()));
In the code above my result is : 2017/9/14
How to show the persian date with the library I said
call the function like this
PersianDate pdate = new PersianDate(Calendar.getInstance(());
PersianDateFormat pdformater1 = new PersianDateFormat('Y/m/d');
pdformater1.format(pdate);
and if you want to parse a string date use this:
PersianDateFormat pdformater1 = new PersianDateFormat("yyyy/MM/dd");
try {
PersianDate persianDate = pdformater1.parse("1397/06/21");
Log.e("DATE", "date " + persianDate.getShYear() + "-" + persianDate.getShMonth() + "-" + persianDate.getShDay());
} catch (ParseException e) {
e.printStackTrace();
}