java - 2.2 and 4.1.2 differences in SimpleDateFormat? -
i have code:
public static string week_day_short = "c"; public static string getweekday(int day) { gregoriancalendar calendar = new gregoriancalendar(); calendar.set(calendar.day_of_week, day + 2); dateformat formatter = new simpledateformat(week_day_short + ", " + date); return formatter.format(calendar.gettime()); }
when run method on 4.1.2 okay , outputs mo;di;mi;...
when run on 2.2 following error:
java.lang.illegalargumentexception: unknown pattern character - 'c' @ java.text.simpledateformat.validateformat(simpledateformat.java:379) @ java.text.simpledateformat.validatepattern(simpledateformat.java:428) @ java.text.simpledateformat.<init>(simpledateformat.java:499) @ java.text.simpledateformat.<init>(simpledateformat.java:363) @ de.mayerhofersimon.vertretungsplan.utils.datehelper.getweekday(datehelper.java:54)
the same when try "cc"
short dayname or "cccc"
long dayname.
are there differences in simpledateformat
class between 2.2 , 4.1.2 ? , how can fix this?
try using "eeee" dayname, , "eee" short dayname
Comments
Post a Comment