mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 19:47:36 +00:00
WIP DateTypeConverter実装
This commit is contained in:
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user