WIP DateTypeConverter実装

This commit is contained in:
r-ca 2023-12-14 03:40:56 +09:00
parent c46ffd8454
commit 8663b86fc6
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -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();
}
} }