[JSP ]MySQL 取值問題

看板java作者 (uishi)時間16年前 (2009/04/27 22:47), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/3 (看更多)
請問一下 我資庫裡面有一資料表 --------------------------------- | UserID | LoginTime | |-------------------------------- | a7752035 | 2009-01-23 23:16:25| |-------------------------------- | uishisy | 2009-03-24 14:08:45| Class.forName("com.mysql.jdbc.Driver"); Connection con =DriverManager.getConnection ("jdbc:mysql://127.0.0.1:3306/health","root","1111"); Statement smt=con.createStatement(); String sql = "select * from lookorder_gotoadoctor"; if(!stdid.equals("")){ sql = sql+" where stdid='"+stdid+"'"; } ResultSet rs = smt.executeQuery(sql); while(rs.next()){ out.print(rs.getString("LoginTime")); } 請問有什麼方法可以讓年月日分開顯示? out.println(rs.getString("LoginTime")); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.68.92.166

04/27 23:12, , 1F
SimpleDateFormat
04/27 23:12, 1F
文章代碼(AID): #19zSM7kV (java)
文章代碼(AID): #19zSM7kV (java)