title: Storing/retrieving DateTime
body: <p>I've an app that is retrieving a date that is stored as a string as a millisecs from 1970, eg  <code>1324657734883</code>. </p>
  
  <p>I have a <code>ListView</code> that displays this date asis. I'd like to display the joda <code>DateTime</code> from this field in the database. My view displays the listview and populates it by using <code>startManagingCursor()</code> so i don't think there is any way of converting the <code>milisec</code> format to a <code>DateTime</code> before it is populated to the <code>listview</code>. </p>
  
  <p>Is there a way around this or do i have to store a DateTime and if so what is the column type i need to declare to store this type of data?</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      nfcscannerapplication = (NfcScannerApplication) getApplication();
  
      // setup UI
      setContentView(R.layout.viewtransactions);
      setTitle(getCarername() + " has completed " + nfcscannerapplication.loginValidate.getNumberOfTransactions() + " visits today");
      //transactionCount = (TextView)findViewById(R.id.textviewtransactionsfordaycount);
      viewTransactions = (ListView) findViewById(R.id.listviewtransactions);
  
      //transactionCount.setText("You have completed 6 transactions today");
  
      // get data
      cursor = nfcscannerapplication.loginValidate.queryAllFromTransactions();
      startManagingCursor(cursor);
  
      // setup adapter and show the data
  
  
  
  
      String[] from = { 
              LoginValidate.C_NAME, LoginValidate.C_TAG_SCAN_TIME,
              LoginValidate.C_TAG_SCAN_TIME};
      int[] to = { R.id.rowcarername, R.id.rowsignedinoutstatus, R.id.rowsenttoserverat };
  
      adapter = new SimpleCursorAdapter(nfcscannerapplication, R.layout.rowdataactual,
              cursor, from, to);
      viewTransactions.setAdapter(adapter);
  
  
  }
  
  }
  </code></pre>
  
  <p>.</p>
  
  <p>[update1]
      public class ViewTransactions extends NfcBaseActivity{</p>
  
  <pre><code>private static final String TAG = ViewTransactions.class.getSimpleName();
  
  NfcScannerApplication nfcscannerapplication;
  Cursor cursor;
  ListView viewTransactions;
  SimpleCursorAdapter adapter;
  MyAdapter myAdapter;
  //TextView transactionCount; //now written to status bar
  
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      nfcscannerapplication = (NfcScannerApplication) getApplication();
  
      // setup UI
      setContentView(R.layout.viewtransactions);
      setTitle(getCarername() + " has completed " + nfcscannerapplication.loginValidate.getNumberOfTransactions() + " visits today");
      //transactionCount = (TextView)findViewById(R.id.textviewtransactionsfordaycount);
      viewTransactions = (ListView) findViewById(R.id.listviewtransactions);
  
      //transactionCount.setText("You have completed 6 transactions today");
  
      // get data
      cursor = nfcscannerapplication.loginValidate.queryAllFromTransactions();
      startManagingCursor(cursor);
  
      // setup adapter and show the data
  
  
  
  
      String[] from = { 
              LoginValidate.C_NAME, LoginValidate.C_TAG_SCAN_TIME,
              LoginValidate.C_TAG_SCAN_TIME};
      int[] to = { R.id.rowcarername, R.id.rowsignedinoutstatus, R.id.rowsenttoserverat };
  
      myAdapter = new MyAdapter(nfcscannerapplication, R.layout.rowdataactual,
              cursor, from, to);
      viewTransactions.setAdapter(adapter);
  
  
  }
  
  
  class MyAdapter extends SimpleCursorAdapter {
  
      public MyAdapter(Context context, int layout, Cursor c, String[] from,
              int[] to) {
          super(context, layout, c, from, to);
      }
  
      @Override
      public
      View getView(int position, View convertView, ViewGroup parent) {
          View v = super.getView(position, convertView, parent);
          if(v == null)
              return null;
  
          Cursor c = (Cursor)getItem(position);
          String val = c.getString(c.getColumnIndex(LoginValidate.C_TAG_SCAN_TIME));
          Date dt = new Date(Long.parseLong(val));
          SimpleDateFormat df = new SimpleDateFormat("dd MMMM yyyy");
          String res = df.format(dt);
  
          ((TextView)v.findViewById(R.id.rowsignedinoutstatus)).setText(res);
          ((TextView)v.findViewById(R.id.rowsenttoserverat)).setText(res);
  
          return v;
      }
  }
  
  }
  </code></pre>