当前页面: 开发资料首页 → 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用的是哪个