Home > Mobile >  How to get Epoch(unix) timestamp in Jenkins declarative pipeline code
How to get Epoch(unix) timestamp in Jenkins declarative pipeline code

Time:06-29

im working on Jenkins to automate my test runs in my project and as a task/stage where i need to fetch or use epoch timestamp in stage. Could you please help me with your suggestions how can i achieve it?

Required Format: 1656166890987

CodePudding user response:

You can simply do the following.

steps {
       script {
          def time = new Date().getTime()
          echo "$time"
      }
}
  • Related