# Crop the value of date just to '29/03/2018' ignoring the time

**URL:** <https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937>\
**Category:** Logstash\
**Created:** [July 27, 2018, 11:53am UTC](https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937 "2018-07-27T11:53:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kolli\_dilip](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kolli_dilip/32/33821_2.png) [@kolli\_dilip](https://discuss.elastic.co/u/kolli_dilip)\
**Post date:** [July 27, 2018, 11:53am UTC](https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937/1 "2018-07-27T11:53:54Z")

</div>

Hi all

For a field in CSV "Time Closed" the value is '29/03/2018 09:29'

I need to crop the value just to '29/03/2018' ignoring the time

so how can i do this using the Date plugin

thanks in advance

---

<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:** [July 27, 2018, 12:03pm UTC](https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937/2 "2018-07-27T12:03:12Z")

</div>

I would do this using a mutate filter.

```
mutate { gsub => ["somefield", "^([^]+) .*", "\1" ] }
```

---

<div class="post-metadata">

**Author:** ![kolli\_dilip](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kolli_dilip/32/33821_2.png) [@kolli\_dilip](https://discuss.elastic.co/u/kolli_dilip)\
**Post date:** [July 27, 2018, 12:04pm UTC](https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937/3 "2018-07-27T12:04:15Z")

</div>

thank you, but can you please elaborate on this

---

<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:** [July 28, 2018, 11:56am UTC](https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937/4 "2018-07-28T11:56:45Z")

</div>

The regexp has two parts. The first is '^([^]+)', which matches the beginning of the line followed by multiple characters that are not space. This is wrapped in (), which causes the regexp processor to capture whatever the pattern matches (which is 29/03/2018). That's followed by ' .\*' which is a single space followed by the rest of the line. The replacement string is '\1', which is a reference to the first capture group.

---

<div class="post-metadata">

**Author:** ![kolli\_dilip](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kolli_dilip/32/33821_2.png) [@kolli\_dilip](https://discuss.elastic.co/u/kolli_dilip)\
**Post date:** [July 28, 2018, 2:04pm UTC](https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937/5 "2018-07-28T14:04:46Z")

</div>

many thanks, will explore for more thanks again

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 25, 2018, 2:04pm UTC](https://discuss.elastic.co/t/crop-the-value-of-date-just-to-29-03-2018-ignoring-the-time/141937/6 "2018-08-25T14:04:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
