검색결과 리스트
글
LANGUAGE/Java & Groovy
2016. 2. 26. 22:14
///// Java (자바)
///// Comparing Dates (날짜 비교)
boolean isValidDate(String startDt, String endDt){
// startDt <= someDt <= endDt
DateFormat dtf = new SimpleDateFormat("yyyy-MM-dd")
Date someDt = new Date() // Now
Date fromDt = dtf.parse(startDt)
Date toDt = dtf.parse(endDt)
return (someDt.after(fromDt) && someDt.before(toDt+1))
}
isValidDate('1990-01-01', '9999-01-01')
///// 참조 (Reference)
How to compare dates in Java?:
http://stackoverflow.com/questions/2592501/how-to-compare-dates-in-java
Parse String to Date with Different Format in Java:
http://stackoverflow.com/questions/882420/parse-string-to-date-with-different-format-in-java
'LANGUAGE > Java & Groovy ' 카테고리의 다른 글
[Java] Annotation 어노테이션 (0) | 2016.02.29 |
---|---|
[Groovy] 그루비 편리한 기능 (0) | 2016.02.26 |
[Java] Serialize & Deserialize (직렬화 & ??? ) (0) | 2016.02.07 |
[SPRING] RestTemplate Timeout (0) | 2016.01.26 |
[Groovy] 클로저(Closure) 만들기 (0) | 2016.01.24 |