views:

60

answers:

2

So this is my code to generate the current datetime for make an insertion in the google table 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>";

But when i look in the google dataviewer in the app dashboard i see the correct date but the time is set to 00:00:00

So if anyone can help me i will appreciate too much...

+1  A: 

Apart from the fact that you are building the SQL dynamically with string concatenation (SQL injection), you should try outputting the date in the logs. AFAIK, App Engine uses the default Java logging facility. This might need some configuration but if you are developing with Eclipse and the Google plug-in, there should be an example included. Maybe the date column in the registration table just doesn't support time?

Martin Klinke
Thanks a lot man... I need that field to query on the logged users
Alejandro
A: 

I will assume you are using the java.sql.Date object to store fetcha.

If you look at the API for this, the Date object only stores year/month/day

SQL Date values do not have a time component

Sean
well im using java.util.Date and when i exxecute the same operation in my local Mysql server it has no problems...
Alejandro