You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some code where I was to store the Timestamp now (using CURRENT_TIMESTAMP) into a row, then after some time check whether a day has passed or not. Currently, the date sets just fine, and I can read the correct value with the SQLite CLI. But when using my code to get the timestamp, it always returns 1969-12-31T16:00:02.019 no matter what I set it to.
No exceptions were thrown.
My code for reading the timestamp:
ResultSetrs = DB.prepareStatement("SELECT * FROM Cooldown WHERE UUID = \"" + uuid + "\"").executeQuery();
if(!rs.next()){
rs.close();
//all System.out.println calls are debug lines that I used to find where the bug occurredSystem.out.println("-1");
returnfalse;
}
LocalDateTimelast = rs.getTimestamp("LastReward").toLocalDateTime();
LocalDateTimenow = LocalDateTime.now();
System.out.println("0");
System.out.println(rs.getTimestamp("LastReward") + " " + last.toString() + " " + now.toString());
I can't seem to reproduce the problem.
Can you provide more details (such as OS, sqlite-jdbc version, jdk/jre version and vendor) and a short self contained example? A short sample that creates a table, inserts a row with timestamp and reads it again should suffice.
There is however a deviation in your results that shouldn't be there. According to the reference there shouldn't be any miliseconds reported.
The format for CURRENT_TIMESTAMP is "YYYY-MM-DD HH:MM:SS"
This has been proven time and time again (See bug #88 ) to be true.
This is where your code should break down. As rs.getTimestamp("LastReward") breaks down for a lack of those same milliseconds.
In neither case do you end up with an end of 1969 date however. The obvious 1970 epoch reference is in there, minus a few hours. So that definately isn't a coincidence.
In any case it would help to actually be able to reproduce your problem.
I have some code where I was to store the Timestamp now (using CURRENT_TIMESTAMP) into a row, then after some time check whether a day has passed or not. Currently, the date sets just fine, and I can read the correct value with the SQLite CLI. But when using my code to get the timestamp, it always returns 1969-12-31T16:00:02.019 no matter what I set it to.
No exceptions were thrown.
My code for reading the timestamp:
Output:
The text was updated successfully, but these errors were encountered: