Time stamp of change status

Hi All,
Iam able to get the timestamp of all the status but i need the status of particular status and its latest timestamp.

code :
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()

def inProgressName = “Done”

List rt = [0L]
def changeItems = changeHistoryManager.getChangeItemsForField(issue, “status”)
changeItems.reverse().each {ChangeItemBean item →
item.toString == inProgressName
def timeDiff = item.created
return timeDiff

can anyone help in this code pls