Topic: 怎么在JSP中用SQL语句在数据库插入当前日期 |
Print this page |
1.怎么在JSP中用SQL语句在数据库插入当前日期 | Copy to clipboard |
Posted by: linkeca Posted on: 2005-10-14 22:31 小弟是初学者,我需要在数据中插入当前时候,请高手指点! |
2.Re:怎么在JSP中用SQL语句在数据库插入当前日期 [Re: linkeca] | Copy to clipboard |
Posted by: njptzzh Posted on: 2005-10-18 18:33 public String GetTime(){ String dateString="123"; try{ java.text.SimpleDateFormat formatter=new java.text.SimpleDateFormat("yyyy-MM-dd"); java.util.Date currentTime_1=new java.util.Date(); dateString=formatter.format(currentTime_1); }catch(Exception e){ } return dateString; } |
3.Re:怎么在JSP中用SQL语句在数据库插入当前日期 [Re: linkeca] | Copy to clipboard |
Posted by: Julian13 Posted on: 2005-10-18 23:38 just in case you willing to do it via native SQL ways, you should check from your database vendor documentation. for exampel, in oracle, you can use reserved keyword "SYSDATE" in SQL statement to get the machine date (and time); similar case in either MSSQL, MySQL, etc. Pleaes figure out the best way for your requirements. |
4.Re:怎么在JSP中用SQL语句在数据库插入当前日期 [Re: linkeca] | Copy to clipboard |
Posted by: linkeca Posted on: 2005-10-21 08:48 谢谢njptzzh! 问题已解决!感谢!感谢! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |