Not recommended way
Warning: Take care of time zone information
You can convert LocalDate into timestamp and compare the timestamp.
val timestamp = Timestamp.valueOf(localDate.atStartOfDay)
Your method becomes
val userSuppliedLocalDate: LocalDate = ...
val userSuppliedTimestamp = Timestamp.valueOf(localDate.atStartOfDay)
usersTable.filter(_.modifiedDate === userSuppliedTimestamp).result
But, this is not the recommended way.
If you want to compare timestamp of particular day. One Hack would be
val start = Timestamp.valueOf(localDate.atStartOfDay())
val end = Timestamp.valueOf(start.plusDays(1))
usersTable.filter(row => row.modifiedDate >= start && row.modifiedDate < end).result
Recommended way is to use LocalDate itself as slick table column.
How is this possible?
This possible with slick column mapper.
Have below implicit in the scope.
implicit val mapper = MappedColumnType.base[LocalDate, Timestamp](
_.toLocalDateTime().toLocalDate(),
Timestamp.valueOf)
Now you can have a LocalDate column directly
def birthday = column[LocalDate]("birthday")
Now you can directly compare
def birthdaysBefore(localDate: LocalDate) =
query.filter(_.birthday < localDate).result
You can use other comparison operators as well.