I\'m using \"groovy script\" plugin as part of my Jenkins build. I wish to find the last successful build date of a job \"RegularBuild\" however all the examples online e.g.
Following sample will help you. I generally find it useful to setup a plugin development environment and see the actual Types and check documentation
import jenkins.model.Jenkins
def item = Jenkins.instance.getItem("your-job-name")
def f=item.getLastFailedBuild()
println f.getTime()
def ff=item.getLastSuccessfulBuild()
println ff.getTime().format("YYYY-MMM-dd HH:mm:ss")
println ff.getTime().format("dd-MM-yyyy")
Edit
(From comments of @Steven the Easily Amused )
If the Jenkins uses folders , then you need getItemByFullName("/folder/yourjobname")
Edit 2
Fix date/time format s/MM:SS/mm:ss/ (substitute digits-of-month:milliseconds with minutes:seconds)