사용자 도구

사이트 도구


groovy:datetime

문서의 이전 판입니다!


Groovy Date/Time

날짜 지정/값 읽기

// 특정 날짜 지정 객체 생성
Date.parse('yyyy/MM/dd','2012/11/29')
 
// 특정 날짜와 시간 지정 객체 생성
Date.parse('yyyy/MM/dd HH:mm:ss','2012/11/29 18:24:37')
 
// 객체의 특정 값 읽기 Date.getAt(), java.util.Calendar.* 사용
now = new Date()
println 

TimeCategory

  • 날짜를 더하고 빼기를 할 수 있다.
use ( TimeCategory ) {
   // application on numbers:
   println 1.minute.from.now
   println 10.hours.ago
 
 
   // application on dates
   def someDate = new Date()
   println someDate - 3.months
}
groovy/datetime.1354182830.txt.gz · 마지막으로 수정됨: 2012/11/29 18:53 저자 kwon37xi