Skip to content
프로젝트

소개

Joda Time용 Scala 래퍼

기타 프로젝트

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original
A Scala wrapper for Joda Time

USAGE:

  import org.scala_tools.time.Imports._

  DateTime.now
	// returns org.joda.time.DateTime = 2009-04-27T13:25:42.659-07:00

	DateTime.now.hour(2).minute(45).second(10)
	// returns org.joda.time.DateTime = 2009-04-27T02:45:10.313-07:00

  DateTime.now + 2.months
  // returns org.joda.time.DateTime = 2009-06-27T13:25:59.195-07:00

  DateTime.nextMonth < DateTime.now + 2.months
  // returns Boolean = true

	DateTime.now to DateTime.tomorrow
	// return org.joda.time.Interval =
	//   2009-04-27T13:47:14.840/2009-04-28T13:47:14.840

	(DateTime.now to DateTime.nextSecond).millis
	// returns Long = 1000
	
	2.hours + 45.minutes + 10.seconds
	// returns org.scala_tools.time.DurationBuilder
	// (can be used as a Duration or as a Period)
	
	(2.hours + 45.minutes + 10.seconds).millis
	// returns Long = 9910000	
	
	2.months + 3.days
	// returns Period

This is mostly a convenience wrapper around the Joda Time libraries, adding
more pleasant syntax like operators for addition, subtraction, and comparison.
Also, most fields usually available as "getField" are now simply available as
"field", following the Scala convention. Some instances of "asX" or "toX" have
also been shortened.

Please see Joda Time for full explanation of key concepts and API:
http://joda-time.sourceforge.net/index.html

INSTALLATION:

Add the following to your sbt build:

  libraryDependencies += "org.scalaj" %% "scalaj-time" % "0.7"

MOTIVATION:

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 much richer 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.

관련 프로젝트 살펴보기

불러오는 중…