Android Question Unparseable Date

abhishek007p

Active Member
Licensed User
Longtime User
One of my app is crashing with error 'Unparseable date' The user reported that he is using 'Samsung A9' with 'Traditional Chinese' device language. this app is a birthday manager and was build using B4A v4.0

here is screenshot
Clipboard03.jpg
 
DateTime.DateFormat = "MMM dd, yyyy"

Example - March 04, 2018

the link you gave forces US Locale on users, would not they get confused ?
 
Upvote 0
the link you gave forces US Locale on users, would not they get confused ?

You could always retrieve the current locale information first, set the US locale, parse your date and then reset the default locale.

Code:
Dim defaultLocale As JavaObject
Dim jo As JavaObject
'Safe Locale
defaultLocale = jo.InitializeStatic("java.util.Locale").RunMethod("getDefault", Null)
jo.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(jo.GetField("US")))
'
' Process your date
'
'Restore Locale
jo.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(defaultLocale))
 
Upvote 0

Similar Threads

Replies
9
Views
4K
  • Question Question
Android Question Unparseable Date
Replies
3
Views
3K
  • Question Question
Android Question Unparseable date
Replies
1
Views
9K
  • Question Question
Android Question Unparseable Date
Replies
7
Views
4K
Back
Top