title: Retrieve date value in jenkinsfile
body: <p>I have a job to push some values to consul based on user parameters and 2 values are generated when the pipeline is run like shutdown_date and termination_date:</p>
  
  <pre><code>def now, shutdown_date, termination_date
  pipeline {
  
          parameters {
              string(name: 'env', defaultValue: 'abc')
              string(name: 'owr', defaultValue: 'abc')
              string(name: 'de', defaultValue: 'abc')
              string(name: 'tct', defaultValue: 'abc-123')
          }
  
  
          agent  { label 'abc' }
          stages {
              stage ('Update ENV'){
                steps {
                      script {
                          now = new Date()
                          println now.format("yyyy-MM-dd", TimeZone.getTimeZone('UTC'))
                          shutdown_date = now + 170
                          shutdown_date = (shutdown_date.format("yyyy-MM-dd", TimeZone.getTimeZone('UTC'))).trim()
                          println shutdown_date
                          termination_date = now + 365
                          termination_date = (termination_date.format("yyyy-MM-dd", TimeZone.getTimeZone('UTC'))).trim()
                          println termination_date
                          step([$class: 'ConsulKVBuilder', aclToken: '', apiUri: '', debugMode: 'DISABLED', envVarKey: 'env_status', hostUrl: '', key: 'env_status/${env_name}', keyValue: '{    "owr":"${owr}",    "de":"${de}",    "tct":"${tct}",    "shutdown_date": "${shutdown_date}",    "termination_date": "${termination_date}" }', requestMode: 'WRITE'])
  
                       }
                  }
              }
  
  
          }
  }
  </code></pre>
  
  <p>Expected result:</p>
  
  <p>{    "owr":"abc",    "de":"abc",    "tct":"abc-123",    "shutdown_date": "2020-02-15",    "termination_date": "2020-08-15" }</p>
  
  <p>Actual result:</p>
  
  <p>{    "owr":"abc",    "de":"abc",    "tct":"abc-123",    "shutdown_date": "${shutdown_date}",    "termination_date": "${termination_date}" }</p>