Created
June 15, 2017 05:32
-
-
Save SubhrajyotiSen/523d8652b165714904e0e6d595a0b655 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import java.util.Date; | |
class DateConverter { | |
@TypeConverter | |
public static Date toDate(Long timestamp) { | |
return timestamp == null ? null : new Date(timestamp); | |
} | |
@TypeConverter | |
public static Long toTimestamp(Date date) { | |
return date == null ? null : date.getTime(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment