I'm trying out Java 8 Date Time Api java.time
using Scala REPL. Just encountered the problem below:
I do understand that the keyword with
is reserved in scala, but also it is used in the API. Any idea on how to mitigate the limits?
Java Date-Time Packages. The Date-Time APIs, introduced in JDK 8, are a set of packages that model the most important aspects of date and time. The core classes in the java. time package use the calendar system defined in ISO-8601 (based on the Gregorian calendar system) as the default calendar.
So to use date in scala we can use java library by importing packages. After this we can use its function to deal with date and time in scala, we can parse, format, and create the date from string object as well.
Try wrapping the with with tick marks as follows:
val nextWed = today.`with`(java.time.temporal.TemporalAdjusters.next(DayOfWeek.WEDNESDAY))
Adding the ticks designates it a literal identifier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With