Android : Error Simpledateformat Unknown Pattern Character 'u'
Solution 1:
I use java 1.7.25
No, you don't - not if you're running on Android. You need to look at the Android documentation, not the Java 7 docs.
If you look at the Android SimpleDateFormat
documentation you'll see that u
isn't listed there. I don't believe there's a format pattern character for "day of week as a number" in Android.
Were you really looking for that though? If you just want the day of the week as a number (without anything else) you can always use
Stringtext = String.valueOf(calendar.get(Calendar.DAY_OF_WEEK));
Solution 2:
If you're using android, then you're not using Java 1.7.25. See the android documentation: there's no support for u
in SimpleDateFormat.
Solution 3:
I'm guessing your problem is going to be in your TimeStampConverter
class where you're passing in that "u" as the outputFormat
. "u" is not a valid format character in SimpleDateFormat
and you must be constructing a format string that contains it.
If you need to use the "u" as a literal, you'll need to enclose it in single quotes.
Post a Comment for "Android : Error Simpledateformat Unknown Pattern Character 'u'"