Android Question Problem formating a date read from sqlite

Alberto Michelis

Well-Known Member
Licensed User
Longtime 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

B4X:
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?
 

mangojack

Expert
Licensed User
Longtime User
B4X:
dim f as long
 
Upvote 0
Top