views:

879

answers:

2

I am trying to insert a date value in sqlite db using air and javascript. The value gets inserted but when I try and view it, it says null.

Later I found that SQLite stores date using julian format. How to convert a javascript date object to julian format?

A: 

I got something.

Inserting the data in to SQLite:

 INSERT INTO <table> (<column>) VALUES (’2008-06-09 07:20:00′);

here, the important thing is - <column> data type should be DATETIME.

Fetching the data back from SQLite:

SELECT datetime(<column>) AS <variableName> FROM <table>;
simplyharsh
Not working with parameters.
Hemanshu Bhojak
A: 

Adobe AIR does not support the JS date object. While inserting data I was using

stmt.parameters[":myDate"] = new Date();

This was inserting the date in the database but was not returning it in a useful format. I tried the following and it worked like charm.

stmt.parameters[":myDate"] = new window.runtime.Date();

Ref Here

Hemanshu Bhojak

related questions