title: Store date & time in SQLite database in Android
body: <p>I am a bit confusing about how to store date $ time in SQLite database in Android.
  I need to store current date &amp; time in my database table.</p>
  
  <p>so:</p>
  
  <p>1) Which type to use when creating date/time column in my table? 
  2) How to get current date/time and store it into database table according to the column type chosen?</p>
  
  <p>Regarding point 1) some people says to use a text type, some others to int and some others to datetime..... but SQLite 3 recommends storing date/time as below:</p>
  
  <p><a href="https://www.sqlite.org/datatype3.html" rel="nofollow noreferrer">SQLite 3 documentation</a></p>
  
  <p>I cannot see that SQLite supports datetime type. The only types supported by SQLite are: null, integer, real, text and blob (so datetime is not listed here).</p>
  
  <p>so I do not understand why <a href="https://stackoverflow.com/questions/754684/how-to-insert-a-sqlite-record-with-a-datetime-set-to-now-in-android-applicatio">here</a></p>
  
  <p>it says to use DATETIME as column type and set default value as DEFAULT CURRENT_TIMESTAMP when creating database table.</p>
  
  <p>Storing it as milliseconds, the problem is that timezone is lost. In this case it is said to save that separately and I do not kwnow how to get rid of this...</p>
  
  <p>Regarding point 2), I think of several ways.... using DATETIME('now') or System.currentTimeMillis()... but I do not know if it is the best way....</p>
  
  <p>How can I get rid of this?</p>