Skip to content

Instantly share code, notes, and snippets.

@ksky
Created November 5, 2011 00:39
Show Gist options
  • Save ksky/1340880 to your computer and use it in GitHub Desktop.
Save ksky/1340880 to your computer and use it in GitHub Desktop.
TimeCategoryサンプル
// TimeCategory
import groovy.time.TimeCategory
// 日時計算のための便利なカテゴリ
use (TimeCategory) {
println 10.hours.ago
println 3.days.from.today
println 1.year.from.now
println((1.minute + 30.seconds).from.now)
def now = new Date()
println now - 3.months
println now + 1.week
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment