Android Question Problem formating a date read from sqlite

Discussion in 'Android Questions' started by Alberto Michelis, Jul 13, 2015.

  1. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    I read a date form a sqlite database.
    The fomat is yyyy-dd-MM
    I need it in dd/MM/yyyy
    Im using this code but the resulting year is not ok

    Code:
    dim f as int
    dim fecha as string
            
    DateTime.DateFormat="yyyy-dd-MM"
            f = 
    DateTime.DateParse(cursor1.GetString("fecha"))
            
    Log(cursor1.GetString("fecha")&" "&f)
            
    DateTime.DateFormat="dd/MM/yyyy"
            fecha = 
    DateTime.Date(f)
    The log is: 2015-12-7 -2144044160

    The resulting string is : 07/12/1969

    What am I doing wrong?
     
  2. mangojack

    mangojack Well-Known Member Licensed User

    Code:
    dim f as long
     
    Erel likes this.
  3. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    Thanks !!!!!!!!!!!!!!!
     
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