- Notifications
You must be signed in to change notification settings - Fork78
A new Scala wrapper for Joda Time based on scala-time
License
nscala-time/nscala-time
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A new Scala wrapper for Joda Time. This project forked fromscala-time sinceit seems that scala-time is no longer maintained.
Add the following to your sbt build:
libraryDependencies+="com.github.nscala-time"%%"nscala-time"%"3.0.0"
if you want to use previous versions,you can find it from here
- change private
RichString#toOption
method - Drop Scala 2.9.3 support
- use
FiniteDuration
instead ofDuration
- joda-time 2.9.3
- adding the flexibility to include format for local date and date time. Seescaladoc
- joda-time 2.8.2
- Add parentheses to methods which are not purely-functional
object BuilderImplicits
should not extendstrait Implicits
- Add method to convert an interval into a collection
- joda-time 2.7
- Add arithmetic and others methods to Duration, Interval, and Period
- joda-time 2.5
- drop Scala 2.9.1 and 2.9.2 support
- conversion to and from scala std duration
- Added static method wrappers
- joda-time 2.4 support
- Remove implicit DateMidnightOrdering
- Add toInterval to RichString
- Add millis method to RichDateTime
- Remove deprecated class RichMidnight
- Make DurationBuilder public
- Binaries compiled with Scala 2.11.0 are included.
- #53
Binaries compiled with Scala 2.11.0-M8 are included.
Two major changes has been introduced in 0.6.0:
Although I believe that these changes don't break your code, if you have some problems,don't mind reporting the problem toissues.
x.y.z
, each letter is digit, format is used as version number. Meanings ofx
is not determined yet.y
means major-version. Note thaty
is even number in any version of releasednscala-time
. Ify
is odd,it's development and/or SNAPSHOT version.z
is mainly used for bug fix releases. Currently, the value ofz
is 0in most cases.
This is mostly a convenience wrapper around the Joda Time libraries, addingmore pleasant syntax like operators for addition, subtraction, and comparison.Also, most fields usually available asgetField
are now simply available asfield
, following the Scala convention. Some instances ofasX
ortoX
havealso been shortened.
importcom.github.nscala_time.time.Imports._
DateTime.now()+2.months// returns org.joda.time.DateTime = 2009-06-27T13:25:59.195-07:00DateTime.nextMonth<DateTime.now()+2.months// returns Boolean = trueDateTime.now() toDateTime.tomorrow// return org.joda.time.Interval = > 2009-04-27T13:47:14.840/2009-04-28T13:47:14.840(DateTime.now() toDateTime.nextSecond).millis// returns Long = 10002.hours+45.minutes+10.seconds// returns com.github.nscala_time.time.DurationBuilder// (can be used as a Duration or as a Period)(2.hours+45.minutes+10.seconds).millis// returns Long = 99100002.months+3.days// returns Period
DateTime.now()// returns org.joda.time.DateTime = 2009-04-27T13:25:42.659-07:00DateTime.now().hour(2).minute(45).second(10)// returns org.joda.time.DateTime = 2009-04-27T02:45:10.313-07:00
Please see Joda Time for full explanation of key concepts and API:https://www.joda.org/joda-time/
Documentation of joda-time will be also a help.
The Java Date and Calendar libraries are largely inadequate. They are mutable, not thread-safe, and very inconvenient to use.
The Joda Time library is a great replacement for Java's Date and Calendar classes. They're immutable by default, have a muchricher and nicer API, and can easily be converted to Java's Date and Calendar classes when necessary.
This project provides a thin layer of convenience around the Joda Time libraries, making them more idiomatic to use within Scala.
About
A new Scala wrapper for Joda Time based on scala-time
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.