Date endDate = new Date();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -10);
Date startDate = new Date(cal.getTimeInMillis());

LocalDateTime start = LocalDateTime.ofInstant(startDate.toInstant(), ZoneId.systemDefault());
LocalDateTime end = LocalDateTime.ofInstant(endDate.toInstant(), ZoneId.systemDefault());

long days = ChronoUnit.DAYS.between(start, end);​

 

 

Document Jsoup 문서 못불러올때 처리 방법

 


Jsoup 에서 문서 로드 기본 용량은 1MB.

제한 없이 불러올때는 maxBodySize(0) 을 추가한다.

0은 제한없는 값이고 원하는 용량 사이즈를 넣으면 된다.

Document document = Jsoup.connect("http://www.naver.com")
        .userAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36")
        .timeout(10000)
        .maxBodySize(0)
        .get();

The default capacity for loading documents in Jsoup is 1MB.
Add maxBodySize (0) when loading without restriction.
0 is an unlimited value and you can add the desired capacity size.

 

+ Recent posts