iOS Question Unparseable date

Pendrush

Well-Known Member
Licensed User
Longtime User
Error parsing: Sun, 05 Feb 2017 22:06:02 +0100
B4X:
DateTime.DateFormat = "EEE, dd MMM yyyy HH:mm:ss Z"
Dim sDate As String = "Sun, 05 Feb 2017 22:06:02 +0100"
Dim lngDate As Long = DateTime.DateParse(sDate) '<- Error in this line

For Android answer: https://www.b4x.com/android/forum/threads/unparseable-date.75927/

I need to change Locale to US in iOS, anyone know how?
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Yes:
B4X:
SetDateTimeLocale ("en_US")

Sub SetDateTimeLocale (locale As String)
   Dim loc As NativeObject
   loc = loc.Initialize("NSLocale").RunMethod("localeWithLocaleIdentifier:", Array(locale))
   Dim no As NativeObject = DateTime
   no.GetField("dateFormat").SetField("locale", loc)
   no.GetField("timeFormat").SetField("locale", loc)
End Sub
 
Upvote 0
Top