ProductPromotion
Logo

Scala

made by https://0x3d.site

GitHub - chronoscala/chronoscala: A JSR-310 port of nscala_time
A JSR-310 port of nscala_time. Contribute to chronoscala/chronoscala development by creating an account on GitHub.
Visit Site

GitHub - chronoscala/chronoscala: A JSR-310 port of nscala_time

GitHub - chronoscala/chronoscala: A JSR-310 port of nscala_time

chronoscala

GitHub Actions Workflow Status Maven Central Version

A JSR-310 port of nscala_time

Supported environment

  • Scala 2.12.x / 2.13.x / 3.x.x
    • Requries Java 8 or later
  • Scala.js
  • Scala Native

Installation

libraryDependencies += "io.github.chronoscala" %% "chronoscala" % LATEST_VERSION

Usage

import io.github.chronoscala.Imports._

ZonedDateTime.now() + 2.months // returns java.time.ZonedDateTime = 2016-09-12T02:24:22.724+09:00[Asia/Tokyo]

OffsetDateTime.now() + 2.months // returns java.time.OffsetDateTime = 2016-09-12T02:24:22.724+09:00

ZonedDateTime.now() < ZonedDateTime.now() + 1.month // returns true

ZonedDateTime.now() to (ZonedDateTime.now() + 1.day) // returns Interval(2016-07-11T19:15:42.641Z,2016-07-12T19:15:42.641Z)

(ZonedDateTime.now() to (ZonedDateTime.now() + 1.second)).millis // returns 1000

2.hours + 45.minutes + 10.seconds // returns PT2H45M10S

(2.hours + 45.minutes + 10.seconds).millis // returns 9910000

2.months + 3.days // returns P2M3D

LocalDate.now() to (LocalDate.now() + 7.days) by 2.days // returns DateInterval(2016-09-04, 2016-09-06, 2016-09-08, 2016-09-10)

Chronoscala also provides NamespacedImports to avoid conflicts between other package such as scala.concurrent.duration.

import io.github.chronoscala.NamespacedImports._

// Methods are namespaced with `cs`.
2.cs.months + 3.cs.days // returns P2M3D

2L.cs.seconds + 3L.cs.seconds // returns PT5S

ClockProvider

ClockProvider is useful for unit testing.

import io.github.chronoscala.Imports._
import io.github.chronoscala.ClockProvider

ClockProvider.setCurrentClockFixedMillis(0L)

Instant.now() // returns 1970-01-01T00:00:00Z

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory