Skip to content

Getting a timestamp always results in 1969-12-31T16:00:02.019 #399

Closed as not planned
@PermissionError

Description

@PermissionError

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:

ResultSet rs = 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 occurred
                System.out.println("-1");
                return false;
            }
            LocalDateTime last = rs.getTimestamp("LastReward").toLocalDateTime();
            LocalDateTime now = LocalDateTime.now();
            System.out.println("0");
            System.out.println(rs.getTimestamp("LastReward") + " " + last.toString() + " " + now.toString());

Output:

0
1969-12-31 16:00:02.019 1969-12-31T16:00:02.019 2019-02-13T20:29:49.238

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions