WIP DateTypeConverter実装

This commit is contained in:
r-ca committed 2023-12-14 03:40:56 +09:00
1 parent c46ffd8454
commit 8663b86fc6
1 file changed
+12
@@ -1,4 +1,16 @@
package one.nem.lacerta.source.database.common; package one.nem.lacerta.source.database.common;
import androidx.room.TypeConverter;
public class DateTypeConverter { public class DateTypeConverter {
@TypeConverter
public static java.util.Date fromTimestamp(Long value) {
return value == null ? null : new java.util.Date(value);
}
@TypeConverter
public static Long dateToTimestamp(java.util.Date date) {
return date == null ? null : date.getTime();
}
} }