mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
WIP DateTypeConverter実装
This commit is contained in:
parent
c46ffd8454
commit
8663b86fc6
|
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user