1 Reply Latest reply on Sep 1, 2009 10:48 AM by alejandrorrr

    insert current date & time?

    alejandrorrr

      Hello Everyone.

       

      Im creating a small air app using flex builder, im using Sqlite3 for persisting data, but im stuck in something really simple i want to insert the current time and date into a table.

       

      The row in question is built like this:

       

      lastMsgSent TIMESTAMP

       

      If i try to do directly in sqlite i can do something like:

       

      insert into myTable(lastMsgSent) values(datetime('now','localtime);

       

      and it works like a charm. If i try to do this from flex it breaks. with

      Error #2044: Unhandled error:. text=Error #3132: Data type mismatch.

       

      So then i tried with a little AS3 to create the date/time string

       

                      var df:DateFormatter = new DateFormatter();
                      df.formatString = "YYYY-MM-DD J:NN:SS";
                      trace(df.format(myDate));
                      var a:String=myDate.toLocaleDateString();
                      insertStar_query.parameters = [df.format(myDate)];

                      insertStar_query.execute();

       

      And it still breaks. with:

       

      Error #2044: Unhandled error:. text=Error #3132: Data type mismatch.

       

      Now im stuck. Weird thing is that if i do it manually from sqlite it works...

       

       

      Im pretty sure there must be an easier way to do this but im really new to this. Any input is welcome!

       

       

      Thanks!

       

      Alex