Android Question java.lang.IllegalArgumentException: Unknown pattern character 'u'

Shay

Well-Known Member
Licensed User
Longtime User
I want to get number of day (1=Sunday, etc..)
According to this:
http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

B4X:
Sub FindDayOfWeek
   
    Dim Today As Int
   
    DateTime.DateFormat = "u"
    Today = DateTime.Date(DateTime.Now)
    Log (Today)
   
End Sub

Getting error on "u" line
B4X:
Error occurred on line: 61 (OpenJobsCleaning)
java.lang.IllegalArgumentException: Unknown pattern character 'u'
    at java.text.SimpleDateFormat.validateFormat(SimpleDateFormat.java:268)
    at java.text.SimpleDateFormat.validatePattern(SimpleDateFormat.java:323)
    at java.text.SimpleDateFormat.applyPattern(SimpleDateFormat.java:407)
    at anywheresoftware.b4a.keywords.DateTime.setDateFormat(DateTime.java:138)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at pro.avhabait.co.il.openjobscleaning.afterFirstLayout(openjobscleaning.java:102)
    at pro.avhabait.co.il.openjobscleaning.access$000(openjobscleaning.java:17)
    at pro.avhabait.co.il.openjobscleaning$WaitForLayout.run(openjobscleaning.java:80)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4921)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
    at dalvik.system.NativeStart.main(Native Method)
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub FindDayOfWeek as Int
    Dim Date As long = DateTime.Now
    return DateTime.GetDayOfWeek(Date)
End Sub
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Thanks,but isn't a bug?

also I got "7" and I saw on different thread here that is was suppose to give 6 (0=Sunday)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top