# How to extract time and day from date

**URL:** <https://discuss.elastic.co/t/how-to-extract-time-and-day-from-date/193309>\
**Category:** Logstash\
**Created:** [August 1, 2019, 11:19am UTC](https://discuss.elastic.co/t/how-to-extract-time-and-day-from-date/193309 "2019-08-01T11:19:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syed.Ubaid](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Syed.Ubaid](https://discuss.elastic.co/u/Syed.Ubaid)\
**Post date:** [August 1, 2019, 11:19am UTC](https://discuss.elastic.co/t/how-to-extract-time-and-day-from-date/193309/1 "2019-08-01T11:19:20Z")

</div>

I have a column name Date in which field is 11/11/2018 11:29 i want to extract this vale 11/11/2018 11:29 into new column time in which  
time is 11:29 and day is also coming from new column Day  
for example 11/11/2018 is sunday  
i write this for new column  
mutate {  
add\_field =\> {"Time" =\> "%{Date}"}  
}  
then i write

date {  
match =\> ["time","HH:mm:ss"]  
locale =\> en  
timezone =\> "UTC"  
}  
but it adds new column time but it shows 11/11/2018 11:29 i want only 11:29 in time. Can someone help me in this really appreciate it..

Also i want a new column day  
mutate {  
add\_field =\> {"Day" =\> "%{Date}"}  
}

Now the in the day column i want day just drop from the date field 11/11/2018  
which is sunday so my day column will show day and my time column show will show the time and date column which is also present showing full date and time.

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [August 1, 2019, 11:49am UTC](https://discuss.elastic.co/t/how-to-extract-time-and-day-from-date/193309/2 "2019-08-01T11:49:45Z")

</div>

something like `grok { match => { "date" => "%{DATE:date_only} %{TIME:time_only} } }`

---

<div class="post-metadata">

**Author:** ![Syed.Ubaid](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Syed.Ubaid](https://discuss.elastic.co/u/Syed.Ubaid)\
**Post date:** [August 2, 2019, 3:09am UTC](https://discuss.elastic.co/t/how-to-extract-time-and-day-from-date/193309/3 "2019-08-02T03:09:21Z")

</div>

i am not extracting from column field for example your payment has been made on 24-10-2018 23:30 i am extracting from column in which only date field i.e TIme 24-10-2018 23:30  
is coming if i am extracting from msg field then i will use the grok fileter

---

<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 30, 2019, 3:09am UTC](https://discuss.elastic.co/t/how-to-extract-time-and-day-from-date/193309/4 "2019-08-30T03:09:22Z")

</div>

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