Created
November 2, 2013 14:12
-
-
Save watermint/7279291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] Starting scala interpreter... | |
[info] | |
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0-ea). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import java.time._; import etude.calendar._; import etude.region._ | |
import java.time._ | |
import etude.calendar._ | |
import etude.region._ | |
// 土日、日本の祝日、12月30日〜1月3日を休業日とする | |
scala> val ourBusinessDays = businessDays - DayOfWeek.SATURDAY - DayOfWeek.SUNDAY - Country.JAPAN - MonthDay.of(12, 30) - MonthDay.of(12, 31) - MonthDay.of(1, 1) - MonthDay.of(1, 2) - MonthDay.of(1, 3) | |
// 2013年度末まであと100日 | |
scala> (ourBusinessDays between "2013-11-04" and "2014-03-31").size | |
res0: Int = 100 | |
// 中国と一緒にビジネスをする場合はさらに中国の祝日も引いてみる | |
scala> val ourBusinessDaysWithChina = ourBusinessDays - Country.CHINA | |
// 一緒に仕事できるのはあと93日 | |
scala> (ourBusinessDaysWithChina between "2013-11-04" and "2014-03-31").size | |
res1: Int = 93 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JSR-310のAPIを使っているので実行にはJava SE 8以降が必要です。