I need to manipulate and calculate lots of things related to date, such as "is today?", "is before yesterday?", "now plus 3 days" etc. Is there any library or dsl in scala that can help with that? I was hoping for something with implicit conversions.
I will be using it with lift snippets, so Lift helpers works too. I saw that TimeHelpers in lift has some methods, that's a good start but I am looking for something more.
A Domain-Specific Language is a programming language that mimics the terms, idioms, and expressions used among experts in the targeted domain. Code written in a DSL reads like structured prose for the domain.
You can get the current time using the hour formatting over the calendar method variable. The Java functions calendar() and SimpleDateFormat() are valid in Scala also.
Definition of Scala Date Function. In scala we do not have any date-time library or function available, we can use java data time, calendar, Date library to deal with dates in Scala. By using these functions, we can convert our date to a string and vice versa, also we can format our date.
You can use the following scala wrapper for joda-time.
Scala-time
If you have to manipulate java.util.Date
, there is also Moments
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