mardi 20 octobre 2015

Strange result from SQLite query using Swift

I have a table in my DB. In that table, I have a value stored (it's a date, in milliseconds): "1424386800000", in a column named "fechainicio".

I have downloaded SQLite browser in my Mac to actually check that the value is stored, and its correct, and it is.

Later, in my code, I retrieve that value using this:

var fechaInicio:Int64=Int64(results!.intForColumn("fechainicio"))

When I do this, I am receiving the value "-1542342272".

Why is the value retrieved incorrectly?

I have tried also

var fechaInicio:Int64=results!.intForColumn("fechainicio").toIntMax()

and

var fechaInicio=results!.intForColumn("fechainicio")

Isn't Int64 the correct type to retrieve a long value from a database?

Aucun commentaire:

Enregistrer un commentaire