iOS Question Parse Date

Discussion in 'iOS Questions' started by oscarsarrio, Feb 12, 2015.

  1. oscarsarrio

    oscarsarrio Member Licensed User

    I have this code in B4A to subtract two dates (current and a string receipt of a SQL format yyyy-mm-dd HH: mm: ss) and the result is on minutes.

    Code:
    .
    .

    'String format yyyy-mm-dd HH:mm:ss
    yo3=row.Get(8)

    .
    .
    DateTime.DateFormat= "yyyy-MM-dd HH:mm:ss"
    Dim t=DateTime.Date(DateTime.Now) '
    'Miramos hora actualización
    Dim h=(DateTime.DateParse(t)-DateTime.DateParse(yo3))/DateTime.TicksPerMinute 'error in B4i
    Error parsing: 2015-01-14 00:00:00.0 <--- Value : yo3 (string)


    DateTime.DateParse use is not the same?

    Thx
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Change the format to: DateTime.DateFormat= "yyyy-MM-dd HH:mm:ss.S"
    It should also work in B4A / B4J.
     
    oscarsarrio likes this.
  3. oscarsarrio

    oscarsarrio Member Licensed User

    Thx ... Work perfect
     
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