All Projects → nscala-time → Nscala Time

nscala-time / Nscala Time

Licence: apache-2.0
A new Scala wrapper for Joda Time based on scala-time

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to Nscala Time

Vue Ydui
A mobile components Library with Vue2.js. 一只基于Vue2.x的移动端组件库。
Stars: ✭ 2,798 (+236.3%)
Mutual labels:  datetime
Datefinder
Find dates inside text using Python and get back datetime objects
Stars: ✭ 397 (-52.28%)
Mutual labels:  datetime
Angular Moment Picker
Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
Stars: ✭ 536 (-35.58%)
Mutual labels:  datetime
Pandas market calendars
Exchange calendars to use with pandas for trading applications
Stars: ✭ 319 (-61.66%)
Mutual labels:  datetime
Date Io
Abstraction over common javascript date management libraries
Stars: ✭ 382 (-54.09%)
Mutual labels:  datetime
Jedate
jeDate V6.5.0 是一款原生JS开发的 不依赖任何第三方库 大众化的日期控件,她身兼多职,虽不是万能的,但是她却是功能强大多样的美少女,她除了包含 单双面板、区域选择、 多语言、日历固定、有效无效日期、日期时间戳转换、日期加减、限制时分秒、初始化日期加减N、日期标注点、设定年月(YYYY-MM)、日期范围限制、开始日期设定、自定义日期格式、当天的前后若干天返回、时分秒选择、智能响应、自动纠错、节日识别,操作等常规功能外,根据不同的日期格式,显示不同内容,还拥有更多趋近完美的解决方案。更多的是需要你与她的亲密接触与呵护!
Stars: ✭ 433 (-47.96%)
Mutual labels:  datetime
Datez
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!
Stars: ✭ 254 (-69.47%)
Mutual labels:  datetime
Period
PHP's time range API
Stars: ✭ 616 (-25.96%)
Mutual labels:  datetime
Sherlock
Natural-language event parser for Javascript
Stars: ✭ 393 (-52.76%)
Mutual labels:  datetime
Timeago.js
🕗 ⌛ timeago.js is a tiny(2.0 kb) library used to format date with `*** time ago` statement.
Stars: ✭ 4,670 (+461.3%)
Mutual labels:  datetime
Verta
تاریخ شمسی برای لاراول 5 , 6 , 7 , 8 تاریخ جلالی , تاریخ شمسی, پکیج شمسی, تبدیل تاریخ میلادی به شمسی
Stars: ✭ 335 (-59.74%)
Mutual labels:  datetime
Zebra datepicker
A super-lightweight, highly configurable, cross-browser date / time picker jQuery plugin
Stars: ✭ 367 (-55.89%)
Mutual labels:  datetime
Dateutils
nifty command line date and time utilities; fast date calculations and conversion in the shell
Stars: ✭ 458 (-44.95%)
Mutual labels:  datetime
React Datetime Picker
A datetime picker for your React app.
Stars: ✭ 294 (-64.66%)
Mutual labels:  datetime
Calendar Links
Generate add to calendar links for Google, iCal and other calendar systems
Stars: ✭ 544 (-34.62%)
Mutual labels:  datetime
Jalali Moment
Display, parse, manipulate, validate and convert jalali (Persian, Khorshidi, Shamsi) or Gregorian (Miladi) dates and times.
Stars: ✭ 264 (-68.27%)
Mutual labels:  datetime
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (-48.44%)
Mutual labels:  datetime
Kolpa
A fake data generator written in and for Go
Stars: ✭ 645 (-22.48%)
Mutual labels:  datetime
Carbon
A simple, semantic and developer-friendly golang package for datetime
Stars: ✭ 565 (-32.09%)
Mutual labels:  datetime
Pendulum
Python datetimes made easy
Stars: ✭ 4,639 (+457.57%)
Mutual labels:  datetime

nscala-time

Maven Central Scaladoc

A new Scala wrapper for Joda Time. This project forked from scala-time since it seems that scala-time is no longer maintained.

Installation

Add the following to your sbt build (Scala 2.10.x, 2.11.x, 2.12.x and 2.13.x):

libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.26.0"

if you want to use previous versions, you can find it from here

Release Note

2.18.0

2.16.0

2.14.0

2.12.0

2.10.0

  • adding the flexibility to include format for local date and date time. See scaladoc

2.8.0

2.6.0

2.4.0

2.2.0

2.0.0

1.8.0

1.6.0

1.4.0

  • joda-time 2.4 support

1.2.0

1.0.0

0.8.0

Binaries compiled with Scala 2.11.0-M8 are included.

0.6.0

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 to issues.

Version Numbering Policy

x.y.z, each letter is digit, format is used as version number. Meanings of x is not determined yet.
y means major-version. Note that y is even number in any version of released nscala-time. If y is odd, it's development and/or SNAPSHOT version. z is mainly used for bug fix releases. Currently, the value of z is 0 in most cases.

Usage

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.

Import

import com.github.nscala_time.time.Imports._

Date/Time Operations

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 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 = 9910000

2.months + 3.days
// returns Period

Fluent interface

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

Please see Joda Time for full explanation of key concepts and API: https://www.joda.org/joda-time/

Documents

Documentation of joda-time will be also a help.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].