站内搜索: 请输入搜索关键词

当前页面: 开发资料首页JSP 专题jsp中如何在sql语句中获得系统当前时间!谢谢!

jsp中如何在sql语句中获得系统当前时间!谢谢!

摘要: jsp中如何在sql语句中获得系统当前时间!谢谢!


环境:jdk1.5 ,tomcat5.5 ,oracle9i

sql="inser into sms_info(send_date) values("+getdate()+)";


错误:An error occurred at line: 52 in the jsp file: /sendmsg.jsp
Generated servlet error:
The method getdate() is undefined for the type sendmsg_jsp

如果获取系统当前时间? now() 也试过了 也不行哦



oracle 是用 sysdate,

sql="inser into sms_info (send_date) values( sysdate )";




new Date();


use java
public String getDateNow()
{
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar c=Calendar.getInstance();
return dateFormat.format(c.getTime());
}


sysdate 正解

sql server用的是哪个


↑返回目录
前一篇: jsp中,对数据库中的英文字段访问没问题,而中文则无法访问?????????
后一篇: 用hibernate 连接数据库时抛出异常,不知道哪里错了,望高手帮忙找找,谢谢了