The app i'm trying to do is based retrieving current day, week and month data from room database, so my entity only contains id and date, but in an older asked question there was an answer like this:
Date Converter:
@TypeConverter
fun fromTimestamp(value: Long?): Date? {
return value?.let { Date(it) }
}
@TypeConverter
fun dateToTimestamp(date: Date?): Long? {
return date?.time?.toLong()
}
UserDao:
@Dao
interface UserDao {
@Query("SELECT * FROM user WHERE birthday BETWEEN :from AND :to")
fun findUsersBornBetweenDates(from: Date, to: Date): List<User>
}
When i am using it i don't know in (from: Date, to: Date)
what to put in Date and retrieve data.
Is there any tutorial or any help online that i missed and might help me?
And please i'm trying to learn and understand how database and date works, so any help counts.
retrieving current day, week and month data from room database
Why do want to retrieve current day from database?