hankinsoft / SQLPro

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

DateTime Value is shown as 2001/01/01 00:33:44 #958

Closed vdhub closed 4 months ago

vdhub commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

Greetings, I have an app written in XOJO that creates the SQLite DB and handles data.

It seems that since the last update from your side , whatever data I add it always shows it as "2001/01/01 00:33:44"

I did a test on XOJO and created a sample report as I thought that it was from XOJO side and there it works, data is shown properly. it did worked as well before on SQLPro but not anymore since the last update.

To Reproduce Steps to reproduce the behavior: Open the database, check the Date fields , in XOJO I see them as "2024-02-20 09:06:47", in SQLPro I see them as "2001/01/01 00:33:44"

Expected behavior To work as the previous version and to show the proper data

Screenshots Screenshot 2024-02-20 at 09 11 34 this is the sample of the working app and the date timestamp provided

Screenshot 2024-02-20 at 09 12 37

This is the snapshot of the table seen from SQLPro for same db same table.

Environment details (please complete the following information):

Additional context As mentioned earlier I noticed the issue since the last update, did not saw it before.

Issues will be closed until environmental details are provided.

If the above template is not completed, issues with be closed with the statement Issue has been closed. Please edit the initial post (or create a new issue) and follow the template. Once completed, the issue may be reopened.

vdhub commented 4 months ago

is there a way to get the previous version somehow ? as I keep on using the Apple Store one and it got replaced, now if I can work with the previous one until this one gets fixed it is fine for me

Thanks

hankinsoft commented 4 months ago

Could you provide me with a create table/insert statement to reproduce the issue? You can grab the previous available version at: https://sqlprostudio.s3.us-east-1.amazonaws.com/sqlite/SQLProSQLite.2023.60.app.zip.

vdhub commented 4 months ago

Hello, unfortunately it seems that the previous version is doing same thing so no idea since when the issue happens, it seems that only on the new XOJO I get this , no idea why, if you are familiar with XOJO is their SQLite Desktop example , if you don't have it then this is the create statement "CREATE TABLE Team (ID INTEGER NOT NULL, Name TEXT, Coach TEXT, City TEXT, TimeStamp DATETIME, PRIMARY KEY(ID));"

And as code I use their sample code

If Not IsConnected Then MessageDialog.Show("Create the database and create the table first.") Return False End If

Var row As New DatabaseRow Var d As DateTime

// ID will be added automatically row.Column("Name").StringValue = name row.Column("Coach").StringValue = coach row.Column("City").StringValue = city row.Column("TimeStamp").StringValue = d.Now.SQLDateTime //row.Column("TimeStamp").DateTimeValue = d.Now ' in case we want to use the XOJO DateTime

Try App.DB.AddRow("Team", row) Catch err As DatabaseException AddDataStatusLabel.Text = "DB Error: " + err.Message Return False End Try

Return True

In my case I have the option to use DateTimeValue or StringValue, I tried both , on XOJO side I see proper date when I use the interface but when I use the app it shows still same date.

Attached you have the created db so have a look example.sqlite.zip

Let me know if it will help you if I can provide the project example or if you want I can build the app, just I need to know what os , windows or macOS

Thanks

hankinsoft commented 4 months ago

Hi, I think you just need to change the date time display to be 'epoch date time' rather than core data date time. Open preferences/setttings and change the following:

Screenshot 2024-02-20 at 8 45 02 AM

That should sort you out.

vdhub commented 4 months ago

Oh, that did the job, and it seems that it shows proper data, however , epoch came somewhere in 1900 I think, so what happens if we get data older than epoch ? that will be handled properly ?

Thanks

hankinsoft commented 4 months ago

Hi, yes, epoch time earlier than 1900 will be handled properly. I would suggest taking a look at https://en.wikipedia.org/wiki/Unix_time or some other Unix Epoch documentation to get an idea on how it's handled. Cheers!