user3617723
user3617723

Reputation: 1395

Getting date and time in a Workflow Script

From within a workflow script we are using a tool that puts a timestamp into the path, we therefore need to be able to get the current date and time from within the groovy script.

Is there a step or some compatible Java we can use to do this?

Upvotes: 0

Views: 435

Answers (1)

nap
nap

Reputation: 36

import java.text.SimpleDateFormat
{
   ...  
   def dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm");
   def date = new Date();

   println(dateFormat.format(date));
   ...
}

Upvotes: 1

Related Questions