hankinsoft / SQLPro

SQLPro bug & features tracking.
100 stars 27 forks source link

Core Data date string converts to wrong day #893

Closed patricks closed 1 year ago

patricks commented 1 year ago

I have a core data sqlite database with the following timestamp:

Presented in integer:

Screenshot 2023-03-10 at 08 57 54

If I change the settings to present it as core data string:

Screenshot 2023-03-10 at 08 58 26

It looks like the day is wrong, because if I convert it via the website: https://www.epochconverter.com/coredata

I get the following result:

Screenshot 2023-03-10 at 09 01 13
hankinsoft commented 1 year ago

Closed for missing environment details. Please reopen once they have been provided.

**Environment (please complete the following information):**
 - Device: [e.g. iPhone6, MacBook]
 - OS: [e.g. iOS8.1, macOS 11]
 - SQLPro app Version [e.g. SQLPro Studio 2022.x] Please ensure you specify the full app name. (ex: SQLPro Studio, SQLPro for MySQL, etc).
- Target database server [e.g. MySQL, PostgreSQL, Microsoft SQL Server, etc]

**NOTE**
If your environmental details above were not completely filled in, the bug report will be closed until they are provided.
patricks commented 1 year ago

Environment

hankinsoft commented 1 year ago

Thanks! I've submitted a build to the App Store which I think will fix this. In preferences, there are now two core data options:

  1. Core data (local time) string
  2. Core data (utc) string

I believe picking the second option should sort this out for you.

Build should be available tomorrow, but I'll pop a note here once I get notified that Apple has approved it.

patricks commented 1 year ago

Thanks for releasing a new version so quickly. I already installed it, but this doesn't fix my problem.

Take a closer look at the day of the ZSTART column. It always displays the 12. as day, but it should be 13. If I use the integer format I get the following output (see screenshot) 700390980. Converting this with https://www.epochconverter.com/coredata the output is correct (see screenshot).

With localtime setting:

Screenshot 2023-03-13 at 10 06 21

With utc setting:

Screenshot 2023-03-13 at 10 06 38

With integers setting:

Screenshot 2023-03-13 at 10 06 52

Converted:

Screenshot 2023-03-13 at 10 13 27
hankinsoft commented 1 year ago

Could you try https://sqlprostudio.s3.us-east-1.amazonaws.com/sqlite/SQLProSQLite.2023.28.app.zip?

I think that should sort it. If so, I'll submit the App Store build.

patricks commented 1 year ago

Yes this looks better now 👍.

Another thing is that the "display timestamps as" feature only works in the data view. If I query data (example: SELECT ZSTART * from ZRECORD) it is always displayed as integer. But I think this another problem.

hankinsoft commented 1 year ago

Great, I'll get the build submitted to the App Store.

Another thing is that the "display timestamps as" feature only works in the data view. If I query data (example: SELECT ZSTART * from ZRECORD) it is always displayed as integer. But I think this another problem.

No plans on changing that. The query view is meant to display what the user queries for, so if you want dates there, you would query have to manually query:

SELECT datetime(yourcolumn + 978307200, 'unixepoch','localtime')

hankinsoft commented 1 year ago

The App Store version (2023.28) is now available. I'm going to close this issue, but if you find it's not working as expected please feel free to re-open.