Skip to content

ResultSet.getDate() only handles INTEGER datatype, not dates stored as TEXT #4

@jason-s

Description

@jason-s

From http://www.sqlite.org/datatype3.html#datetime:

SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values:

  • TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS").
  • REAL as Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian calendar.
  • INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.

Applications can chose to store dates and times in any of these formats and freely convert between formats using the built-in date and time functions.

When ResultSet.getDate() is called, sqlitejdbc appears to assume the format is the INTEGER UnixTime.

It should also handle the standard ISO8601 format if the date is stored as TEXT as an ISO8601 string. (And probably the REAL option for storing dates, though I've never heard of anyone using that.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions