Search code examples
javascriptsqliteairjulian-date

Inserting date in sqlite db using adobe air and javascript


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?


Solution

  • 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