iOS Question DateTimeParse problem

Discussion in 'iOS Questions' started by Tomas Petrus, Apr 5, 2019.

  1. Tomas Petrus

    Tomas Petrus Active Member Licensed User

    Hi guys what am I missing

    working in B4A

    Code:
    DateTime.DateFormat = "dd.MM.yyyy" //format in which user enter the date
    Dim t As Long = DateTime.DateTimeParse(Datum, Cas) //line 902
    DateTime.DateFormat = "yyyy-MM-dd" //output format
    error in B4i
    Code:
    Error occurred on line: 902 (Main)
    Error parsing date 
    string.
    Stack Trace: (
      CoreFoundation       <redacted> + 
    252
      libobjc.A.dylib      objc_exception_throw + 
    56
      CoreFoundation       <redacted> + 
    0
      result               -[B4IDateTime NSDateToTicks:] + 
    100
      result               -[B4IDateTime DateTimeParse::] + 
    344
      CoreFoundation       <redacted> + 
    144
      CoreFoundation       <redacted> + 
    284
      result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 
    1624
      result               -[B4IShell runMethod:] + 
    448
      result               -[B4IShell raiseEventImpl:method:args::] + 
    1648
     result               -[B4IShellBI raiseEvent:
    event:params:] + 1580
     result               +[B4IDebug delegate:::] + 
    80
     result               -[b4i_main _stringtodate::] + 
    468
     result               -[b4i_main _rozdeldatumcas:] + 
    1068
     CoreFoundation       <redacted> + 
    144
     CoreFoundation       <redacted> + 
    284
     result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 
    1624
     result               -[B4IShell runMethod:] + 
    448
     result               -[B4IShell raiseEventImpl:method:args::] + 
    2172
     result               -[B4IShellBI raiseEvent:
    event:params:] + 1580
     result               -[B4IDebugResumableSub resume::] + 
    356
     result               -[B4I checkAndRunWaitForEvent:
    event:params:] + 552
     result               -[B4IShellBI raiseEvent:
    event:params:] + 1436
     result               -[B4ICommon CallSub4::::] + 
    344
     result               -[B4ICommon 
    CallSub2::::] + 360
     result               -[b4i_httpjob _complete::] + 
    888
     result               -[b4i_httputils2service _completejob::::] + 
    1288
     result               -[b4i_httputils2service _hc_responsesuccess::] + 
    636
     CoreFoundation       <redacted> + 
    144
     CoreFoundation       <redacted> + 
    284
     result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 
    1624
     result               -[B4IShell runMethod:] + 
    448
     
  2. Tomas Petrus

    Tomas Petrus Active Member Licensed User

    data seems to be fine:
    12.04.2019 + 09:10
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    What is the value of Datum? What is the value of Cas?
     
  4. Tomas Petrus

    Tomas Petrus Active Member Licensed User

    Datum = "12.04.2019"
    Cas = "09:10"

    same like in android version
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    The default time format is hh:mm:ss. You need to change it:
    Code:
    DateTime.TimeFormat = "hh:mm"
     
  6. Tomas Petrus

    Tomas Petrus Active Member Licensed User

    yes : )) that could help : )
    or add &":00" I assume
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice