Created
May 18, 2018 08:14
-
-
Save vprabhu/1b6a15bae285f697586aab9bff8d26c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object DateConverter { | |
@TypeConverter | |
fun toDate(timestamp: Long?): Date? { | |
return if (timestamp == null) null else Date(timestamp) | |
} | |
@TypeConverter | |
fun toTimestamp(date: Date?): Long? { | |
return date?.time | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment