Saving DateTimes in iOSSQLiteDatabase

If you are attempting to save a date in iOSSQLiteDatabase into a DateTime or Timestamp field and using the built in parameters be careful! I found out today that if you pass in a Xojo.Core.Date object in it will drop the seconds portion. If you pass in the full string it works just fine.

Didn’t matter if the field type was Timestamp or DateTime. Both field types dropped the seconds.

Not sure if this is a bug or ‘just the way it is’, but thought I’d document it for others.

You can store the .SecondsFrom1970 as double and use that to read back into the constructor of a xojo.core.date instance

Not exactly an ideal solution since SQLite happily stores and queries against the SQL Date Time (with seconds). The double isn’t human readable either if you want to work with the database.

To me, this seems like it might be a Xojo bug.

[quote=319997:@Bob Keeney]Not exactly an ideal solution since SQLite happily stores and queries against the SQL Date Time (with seconds). The double isn’t human readable either if you want to work with the database.

To me, this seems like it might be a Xojo bug.[/quote]

I think it is too. You made a FB case?

Not yet. I’ll want to do an example project to prove it.

Finding time is SO much fun. :slight_smile:

Well i use this and it shows all .

[code]Dim d As Xojo.Core.Date

Label1.Text = d.Now.ToText[/code]

and as a response i get

In my case, and i use it as a time stamp