- Jun 6, 2020
- 11,559
- 4,422
Hi,
To format dates, I use this code:
B4X:
If the date now is "2022-09-04 18:58:20.34" this gives me this:
tmp = "2022-09-04 18:58:20.34"
myDate = "09-04"
That's all fine.
The problem is with my SQLite database. The column is called DueDate, it's TEXT type and the date in it stored like this:
row1>>>"2020-03-01 15:28:30.13"
You can see that the date format is "YYYY-MM-DD HH:MM:SS.SS"
I use this code to format it:
B4X:
This gives me this:
tmp = "2020-03-01 15:28:30.13" << read from the database correctly
myDate = "" <<< Gives out the following error:
java.lang.NumberFormatException: For input string: "2020-03-01 15:28:30.13"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at...
To format dates, I use this code:
B4X:
کد:
محتوای بلوک کدها در دسترس شما نیست. برای مشاهده بلوک کدها، وارد انجمن شوید یاثبت نام کنید
If the date now is "2022-09-04 18:58:20.34" this gives me this:
tmp = "2022-09-04 18:58:20.34"
myDate = "09-04"
That's all fine.
The problem is with my SQLite database. The column is called DueDate, it's TEXT type and the date in it stored like this:
row1>>>"2020-03-01 15:28:30.13"
You can see that the date format is "YYYY-MM-DD HH:MM:SS.SS"
I use this code to format it:
B4X:
کد:
محتوای بلوک کدها در دسترس شما نیست. برای مشاهده بلوک کدها، وارد انجمن شوید یاثبت نام کنید
This gives me this:
tmp = "2020-03-01 15:28:30.13" << read from the database correctly
myDate = "" <<< Gives out the following error:
java.lang.NumberFormatException: For input string: "2020-03-01 15:28:30.13"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at...
برای دیدن لینک ها باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید