# How to change Date format from YYYY-MM-DD to DD/MMM/YYYY

**URL:** <https://discuss.elastic.co/t/how-to-change-date-format-from-yyyy-mm-dd-to-dd-mmm-yyyy/132569>\
**Category:** Logstash\
**Created:** [May 19, 2018, 12:50pm UTC](https://discuss.elastic.co/t/how-to-change-date-format-from-yyyy-mm-dd-to-dd-mmm-yyyy/132569 "2018-05-19T12:50:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 19, 2018, 2:40pm UTC](https://discuss.elastic.co/t/how-to-change-date-format-from-yyyy-mm-dd-to-dd-mmm-yyyy/132569/2 "2018-05-19T14:40:54Z")

</div>

```
  mutate { add_field => { "[date1]" => "2018-05-19" } }
  ruby { code => "event.set('date2', Date.strptime(event.get('[date1]'), '%Y-%m-%d').strftime('%d/%b/%Y'))" }

```

does it. Error handling left as an exercise for the reader.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-change-date-format-from-yyyy-mm-dd-to-dd-mmm-yyyy/132569)._
