iOS Question Date TimeParse error on iOS 13.2.2

Binary01

Active Member
Licensed User
Longtime User
Hi,

B4X:
               str1 ="11/09/2019 03:17:43"         'this is date time sample it got from b4j server

                Do While str1.Contains(" ")
                    str1 = str1.Replace(" ","|")
                Loop
              
                Dim serverDateTime() As String
                serverDateTime = Regex.Split("\|", str1.Trim)

                DateTime.DateFormat = "MM/dd/yyyy"
                DateTime.TimeFormat = "HH:mm:ss"
              
                Dim ServerTick As Long = DateTime.DateTimeParse(serverDateTime(0), serverDateTime(1))    ->error in iOS 13.2.2

This code is successfully run until iOS 13.2.
Now my iPhones and iPads are update to 13.2.2. My App shows date time parse error. How can I fix it.
 
D

Deleted member 103

Guest
Try that:
B4X:
    Dim str1 As String ="11/09/2019 03:17:43"
    DateTime.DateFormat = "MM/dd/yyyy HH:mm:ss"
    Dim ServerTick As Long = DateTime.DateParse(str1)
    Log("ServerTick = " & ServerTick)
    Log("Date=" & DateTime.Date(ServerTick))
    Log("Time=" & DateTime.Time(ServerTick))
Log:
ServerTick = 1573265863000
Date=11/09/2019 03:17:43
Time=03:17:43
 
Upvote 0

Binary01

Active Member
Licensed User
Longtime User
DateTime Parsing is ok on iOS 13.2.
But
It shows
Error Parsing :
11/09/2019 03:17:43
on iOS 13.2.2
 

Attachments

  • err.jpg
    err.jpg
    14.7 KB · Views: 157
Last edited:
Upvote 0
D

Deleted member 103

Guest
DateTime Parsing is ok on iOS 13.2.
But
It shows
Error Parsing :
11/09/2019 03:17:43
on iOS 13.2.2
I just upgraded my iPhone to 13.2.2, and found no parsing issues.

iOS 13.1.3:
Application_Start
ServerTick = 1573265863000
Date=11/09/2019 03:17:43
Time=03:17:43
Application_Active


iOS 13.2.2:
Application_Start
ServerTick = 1573265863000
Date=11/09/2019 03:17:43
Time=03:17:43
Application_Active
 
Upvote 0

emexes

Expert
Licensed User
How can I fix it.
If you could log the interim values, eg str1 before (yes...) and after replacing spaces with "|", and serverDateTime(0) and (1), and then post the log including the error message, that would make it easier to determine where the problem arises and thus how to fix it.
 
Upvote 0

Binary01

Active Member
Licensed User
Longtime User
Logs before error.

before loop str1= 11/10/2019 03:48:04
after loop str1= 11/10/2019|03:48:04
serverDateTime(0) = 11/10/2019
serverDateTime(1) = 03:48:04
 
Upvote 0

emexes

Expert
Licensed User
Well that certainly looks ok, perhaps except for: what are you doing working at 3 in the morning?!?! :)

What was the error message?
 
Upvote 0

Binary01

Active Member
Licensed User
Longtime User
Thank emexes,

error is only show on iOS 13.2.2. It's ok on iOS 13.2 or 12.4.x
I also it on iPhone and iPad.

Dim ServerTick As Long = DateTime.DateTimeParse(serverDateTime(0), serverDateTime(1)) ->error in iOS 13.2.2

Error Parsing : 11/10/2019 03:48:04

3 am is server time, it's not local time.
 
Upvote 0

Binary01

Active Member
Licensed User
Longtime User
sample project link is

https://bit.ly/2NV8h7y

This project is run on iOS 14.2.x, 13.2.
But It shows parsing error at line 81 on iOS 13.2.2.

This sample project get server successful message string that included date/time
and convert to local date/time in device.
How can I get server ticks from client b4i?
 

Attachments

  • err (1).jpg
    err (1).jpg
    14.7 KB · Views: 137
Upvote 0
Top