Home > Blockchain >  Timestamping a slack notification from Jenkins pipeline
Timestamping a slack notification from Jenkins pipeline

Time:09-23

 def trial = 'jobName'
 slackSend color: "good", message: "${trial} build successful"

The above code gives me the below Slack message-

jobName build successful

How do I timestamp the message so that I get the below message-

jobName build successful on dd/mm/yyyy

Thanks for the help.

CodePudding user response:

You could use the below piece of code-

def trial = 'jobName'
def date = new Date().format('dd/MM/yyyy')
slackSend color: "good", message: "${trial} build successful on "   date
  • Related