Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use scala-time?

Tags:

scala

sbt

somebody know scala-time? (https://github.com/jorgeortiz85/scala-time) Have no idea how to use it. I can download it (on linux) and run sbt but theres always the same errormessage:

git clone git://github.com/jorgeortiz85/scala-time
cd scala-time
sbt
Getting org.scala-tools.sbt sbt_2.9.1 0.7.4 ...

:: problems summary ::
:::: WARNINGS
        module not found: org.scala-tools.sbt#sbt_2.9.1;0.7.4

    ==== local: tried

      /home/ll/.ivy2/local/org.scala-tools.sbt/sbt_2.9.1/0.7.4/ivys/ivy.xml

      -- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:

      /home/ll/.ivy2/local/org.scala-tools.sbt/sbt_2.9.1/0.7.4/jars/sbt_2.9.1.jar

    ==== Maven2 Local: tried

      file:///home/ll/.m2/repository/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom

      -- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:

      file:///home/ll/.m2/repository/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar

    ==== typesafe-ivy-releases: tried

      http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.7.4/ivys/ivy.xml

      -- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:

      http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.7.4/jars/sbt_2.9.1.jar

    ==== Maven Central: tried

      http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom

      -- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:

      http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar

    ==== Scala-Tools Maven2 Repository: tried

      http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom

      -- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:

      http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar

    ==== Scala-Tools Maven2 Snapshots Repository: tried

      http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom

      -- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:

      http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar

        ::::::::::::::::::::::::::::::::::::::::::::::

        ::          UNRESOLVED DEPENDENCIES         ::

        ::::::::::::::::::::::::::::::::::::::::::::::

        :: org.scala-tools.sbt#sbt_2.9.1;0.7.4: not found

        ::::::::::::::::::::::::::::::::::::::::::::::

huh? Any other options?

like image 345
OverStack Avatar asked Nov 03 '11 12:11

OverStack


People also ask

How do I use date and time in Scala?

Date and time are essential parts of every computer language, including Scala. Scala supports the Java date-time API, so we can use its classes and methods to handle the date-time. The timestamp is a combination of date and time, such as 2022-03-12T11:32:25.148020293.

How to get the current minute in Scala?

The simplest way to get the “current minute” in Scala is to use this approach with the java.util.Calendar class: This approach returns an Int value like 24, meaning “24 minutes after the hour.”

Should I use Java or nscala-time for my next Scala project?

In conclusion, for new projects, we can choose nscala-time if we prefer the idiomatic Scala style of coding. Otherwise, we’ll choose java.time if we prefer less overhead and require high performance. As usual, the full source code can be found over on GitHub.

What is Scala programming language?

Scala is a JVM-based language, therefore, it brings along all the goodness and the issues of the JDK Java libraries. We’ll go through some of the most important ones based on their popularity and functionality.


1 Answers

To actually use it (as compared to building scala-time yourself), just add

libraryDependencies += "org.scala-tools.time" % "time_2.9.1" % "0.5"

to the build.sbt of the project you want to use it in.

Addition:

Current versions may want to use

libraryDependencies += "org.scalaj" %% "scalaj-time" % "0.6"
like image 178
Debilski Avatar answered Sep 18 '22 05:09

Debilski