Answers for "room database Type Converters"

0

room database Type Converters

class Converters {
  @TypeConverter
  fun fromTimestamp(value: Long?): Date? {
  return value?.let { Date(it) }
  }

  @TypeConverter
  fun dateToTimestamp(date: Date?): Long? {
  return date?.time?.toLong()
  }
}
Posted by: Guest on October-09-2021

Browse Popular Code Answers by Language