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?

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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>;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.