public void bs()throws SQLException{ String sql="SELECT \n" + " CAST((strftime('%s', 'now','localtime') - strftime('%s', users.data))/(60 * 60 * 24) AS TEXT) || ' д ' || \n" + " CAST(((strftime('%s', 'now','localtime') - strftime('%s', users.data)) % (60 * 60 * 24))/(60 * 60) AS TEXT) || ' ч ' || \n" + " CAST((((strftime('%s', 'now','localtime') - strftime('%s', users.data)) % (60 * 60 * 24)) % (60 * 60))/60 AS TEXT) || ' м ' \n" + "from users where userId= " + id + ""); con=DriverManager.getConnection(url); stmt=con.createStatement(); res=stmt.executeQuery(sql); System.out.println( ?); 

how now to pull out the result of this query in the system as it appears in sqlite by type: 2d 14h 34m

  • the problem is that all methods of the Resultset class infer a specific column, and how to output the result by subtracting one value from another, which is not recorded in the database, that is the question - Stanislav Alekseev

1 answer 1

Resolved the issue res.getString (1) returned to me exactly the same value as in the visual SQLite editor