title: Elasticsearch 6.2 - how to format date (epoch) field in yyyymm string in painless inline scripting
body: <p>In Elasticsearch 6.2, I have an index where there are two timestamp fields as follows:</p>
  
  <pre><code>"start_ts":  { "type": "date", "format": "epoch_second"  },                       
  "end_ts":    { "type": "date", "format": "epoch_second"  }  
  </code></pre>
  
  <p>In my painless inline script, for some calculation, I want to convert them (<code>doc["start_ts"]</code> and <code>doc["end_ts"]</code>) to this string format (<code>yyyymm</code>). Any idea how can it be done? I could not find any documentation for formatting in ES official documentation. </p>