List<WebElement> li2 = driver.findElements(by.xpath("//td[contains(text(),'" + date " "')]"))
you are using list do you can get the element get (list index starts from 0 )
WebElement li = li2.get(4)
or
you can get 5th result of xpath by enclosing the xpath locator with brackets and calling [5] ( here index starts from 1 )
WebElement li = driver.findElements(by.xpath("(//td[contains(text(),'" + date " "')])[5]"))
If you want to get 5th sibling then don't enclose it with bracket , this will say get the 5th td tag that is a sibling and contains the date
WebElement li = driver.findElements(by.xpath("//td[contains(text(),'" + date " "')][5]"))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…