看板 java 關於我們 聯絡資訊
※ 引述《a7752035 (uishi)》之銘言: : 請問一下 : 我資庫裡面有一資料表 : --------------------------------- : | 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")); 我的意思是 把年月日分開顯示 例如顯示出 2009年1 月23 日 23點 16 分25秒 我out.println("LoginTime"); 只能顯示出 2009-01-23 23:16:25 我想分開顯示 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.68.92.166
wannawanna:用substring拆開印 04/27 23:42
PsMonkey:==.==== SimpleDateFormat 的方向並沒有錯誤 04/28 00:48
hisashi:FORMATTER... 04/28 11:44