Skip navigation
Home/Support/

Forums

801 Views 1 Reply Latest reply: Sep 1, 2009 11:48 AM by alejandrorrr RSS
alejandrorrr User 29 posts since
Aug 28, 2007
Currently Being Moderated

Sep 1, 2009 11:40 AM

insert current date & time?

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

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points