简体   繁体   中英

Extract data inside a Html tag using Jsoup

How to extract only the Date using Jsoup

<p class="byline">
   <a href="https://www.india.com/author/newsdesk/">India.com News Desk</a>
   November 12, 2020 9:31 AM IST                                        
</p>

Try this code sir

Document document = Jsoup.connect(url).get();
Element byline = document.getElementsByClass("byline").first();
String[] array = byline.html().split(">");
String txtDate = array[2];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM