Short answer
As with Slick 3.1, the short answer is to use OffsetDateTime , but you need to map it to String , not Timestamp to work with any database.
That is, you will need MappedColumnType.base[OffsetDateTime, String] . You can use toString and OffsetDateTime.parse to convert strings:
scala> import java.time._ import java.time._ scala> val paris = ZoneId.of("Europe/Paris") paris: java.time.ZoneId = Europe/Paris scala> OffsetDateTime.now(paris) res0: java.time.OffsetDateTime = 2016-01-05T20:38:46.473+01:00 scala> OffsetDateTime.parse(res0.toString) res2: java.time.OffsetDateTime = 2016-01-05T20:38:46.473+01:00
Longer answer
The difference between OffsetDateTime and ZonedDateTime is covered by the answer to What is the difference between java 8 ZonedDateTime and OffsetDateTime? therefore I will not repeat here.
However, you will want to read this to decide if the short answer is appropriate for your situation.
If you use Postgres, support java.time via slick-pg . I have not had the opportunity to use it myself, but it is certainly worth investigating if you use this database. See, for example, the test suite for the "date2" add-in.
Best answer (or "Future answer!")
The great news is that there is an active pull request to add support for java.time data types in Slick. You can track the progress of the ticket that is currently planned for Slick 3.2.
source share