![](/img/trans.png)
[英]How to execute DOS command using java on SERVER side using Google App Engine?
[英]How to retrieve the current server side datetime in Google App Engine with Java
所以这是我的代码,用于生成当前日期时间以在google表jiql_registrations中插入
Date fecha = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
try {
Conn = ConexionGoogle.obtenerConexion();
Statement Stmt = Conn.createStatement();
Stmt.execute("insert or replace INTO registrations VALUES('" + user + "','"
+ identity + "','" + dateFormat.format(fecha) + "')");
if (Conn != null)
Conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
return "\t<update>false</update>";
}
return "\t<update>true</update>";
但是,当我在应用程序仪表板中查看google dataviewer时,我看到了正确的日期,但时间设置为00:00:00
因此,如果有人可以帮助我,我将不胜感激...
除了您要通过字符串连接动态构建SQL(SQL注入)外,还应尝试在日志中输出日期。 AFAIK,App Engine使用默认的Java日志记录功能。 这可能需要一些配置,但是如果您正在使用Eclipse和Google插件进行开发,则应包含一个示例。 也许注册表中的日期列不支持时间?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.