Hi There,
I'm having issues trying to convert a string to a date.
I have found the following post - however that didn't help.
https://www.b4x.com/android/forum/threads/unparseable-date.15544/#post-240642
My Code :
a Spinner [combo box] has a value which the last 8 characters is a date, which I'm then trying to convert.
I get error :
Hope you can help.
I'm having issues trying to convert a string to a date.
I have found the following post - however that didn't help.
https://www.b4x.com/android/forum/threads/unparseable-date.15544/#post-240642
My Code :
B4X:
Dim sDate As String
Dim sHolder As String
sHolder = Value
Dim sLenght As Int
sLenght = sHolder.Length - 8
sDate = sHolder.SubString(sLenght)
DateTime.DateFormat = "dd-MM-yyyy"
Dim t As Long = DateTime.DateParse(sDate)
a Spinner [combo box] has a value which the last 8 characters is a date, which I'm then trying to convert.
I get error :
B4X:
java.text.ParseException: Unparseable date: "20180313"
at java.text.DateFormat.parse(DateFormat.java:362)
at anywheresoftware.b4a.keywords.DateTime.DateParse(DateTime.java:148)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA$1.run(BA.java:325)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Hope you can help.