What is the code to get the current date and time in groovy? I've looked around and can't find an easy way to do this. Essentially I'm looking for linux equivalent of date
I have :
import java.text.SimpleDateFormat
def call(){
def date = new Date()
sdf = new SimpleDateFormat("MM/dd/yyyy")
return sdf.format(date)
}
but I need to print time as well.
def
orSimpleDateFormat
beforesdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
using Java 12 in a Gradle build file. – Kiushu