title: When saving dates to Room database, TypeConverter scrambles the data
body: <p>I've been working on this for hours, and I can't seem to figure out how to save dates to my Room Sqllite database. I'm basically copying the code to do this wholesale from the Android documentation. </p>
  
  <p>Here's what I have.</p>
  
  <p>Database:</p>
  
  <pre><code>@Database(entities = {Review.class},
          version = 3,
          exportSchema=false)
  @TypeConverters(DateTypeConverter.class)
  public abstract class NotecardDatabase extends RoomDatabase {
  ...etc...
  }
  </code></pre>
  
  <p>Entity:</p>
  
  <pre><code>    @Entity(tableName = "review",
          indices = {
                  @Index(value = "next_review"),
          }
  public class Review {
  ...Other columns...
      @TypeConverters(DateTypeConverter.class)
      @ColumnInfo(name ="next_review")
      @NonNull
      private Date nextReview;
  }
  </code></pre>
  
  <p>Next, my converter:</p>
  
  <pre><code>public class DateTypeConverter {
  
      private static Logger log = Logger.getLogger("DateTypeConverter");
      @TypeConverter
      public static Date fromTimestamp(Long value) {
          if(value != null) {
              log.info("Incoming long: " + value + "\nTo Date: " + new Date(value));
          }
          return value == null ? null : new Date(value);
  
      }
  
      @TypeConverter
      public static Long dateToTimestamp(Date date) {
          if(date != null) {
              log.info("Incoming date: " + date + "\n to Long: " + date.getTime());
          }
          return date == null ? null : date.getTime();
      }
  }
  </code></pre>
  
  <p>And finally, here's the output I get from running that when I try to create some Review objects:</p>
  
  <p><strong>06-18 18:13:38.522 7081-7098/DateTypeConverter:</strong> 
  Incoming date: Mon Jun 18 18:13:38 PDT 2018
    to Long: 1529370818524</p>
  
  <p><strong>06-18 18:13:38.522 7081-7106/DateTypeConverter:</strong> 
  Incoming long: 1529370818
  To Date: Sun <strong>Jan</strong> 18 08:49:30 PST <strong>1970</strong></p>
  
  <p>So it seems that it saves correctly (see first log statement), but when I get the thing out of the database, the last 3 digits of the long are simply chopped off, returning a date in 1970.</p>
  
  <p>Help?</p>