So Basically I have a table in MySql DB, which when a user upload something it register the item with an automated timestamp. Now in my client side I need to show the user how long has it been from item upload. Similar like youtube comments or Something like:
Upload Time | MySql TimeStamp: 2017-03-24 22:13:03 Current time: 2017-03-24 22:14:03 The result for has to be 1 hour.
I would really appreciate if someone tell how to do it automatically. I'm using Java, MySql which ever is easy.
Java:
String date = null,item="auniqueid";
String query = "Select date from table where item=?";
try {
        DBConnect Database = new DBConnect();
        Connection con = Database.getcon();
        PreparedStatement ps = con.prepareStatement(query);
        ps.setString(1, item);
        ResultSet rs=ps.executeQuery();
        if(rs.next()){
            date=rs.getString(1);
        }
        ps.close();
        rs.close();
        con.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
Regards
 
     
    