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...