Skip to content

Formatting an int #28

Closed
Closed

Description

@Jonrysh

One field in the database I'm investigating is described as:
dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY,
It's actually, as the name implies, a Unix time field containing seconds since the epoch. If there any way to display it properly in the browser?

Activity

  1. MKleusberg commented on May 30, 2014

    @MKleusberg
    Member

    There is no way to convert an integer into a date string built into SQLIteBrowser. This is mainly because there is no way for us to tell whether a value is to be converted or not. It's made even worse by SQLite allowing all sorts of data types to be mixed even in the same column (i.e. the same column may contain an integer for one row and e.g. a string for the next row, so these column-depending actions require us to do a lot of data checks).

    What you can do though - and what I do for one database I have with epoch dates - is using the native 'datetime()' SQLite function by executing this in the Execute SQL tab of SQLiteBrowser:

    SELECT *,datetime(date_column, 'unixepoch') AS date_column_string FROM table_name;

    You could also create a view of this by clicking the button next to the result view and then on "Save as view".
    For more details and examples on this you may want to check https://www.sqlite.org/lang_datefunc.html
    I hope this helps you a bit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions