# Extract hour and weekday from custom date time field

**URL:** https://discuss.elastic.co/t/extract-hour-and-weekday-from-custom-date-time-field/237286
**Category:** Logstash
**Created:** [June 16, 2020, 11:47am UTC](https://discuss.elastic.co/t/extract-hour-and-weekday-from-custom-date-time-field/237286 "2020-06-16T11:47:53Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)
#### Post date: [June 16, 2020, 12:09pm UTC](https://discuss.elastic.co/t/extract-hour-and-weekday-from-custom-date-time-field/237286/2 "2020-06-16T12:09:50Z")

</div>

This might help:

> [@Strftime is not working Logshtash ruby code](https://discuss.elastic.co/t/strftime-is-not-working-logshtash-ruby-code/88008/3):
>
> The LogStash::Timestamp class has a time method. Try... ruby { code =\> "event.set('read\_time' , event.get('@timestamp').time.strftime('%Y-%m'))" }

and I think that you need to write `.time.localtime` if you don't want to use UTC for the hour and weekday, but your local timezone.

---

_[View the full topic](https://discuss.elastic.co/t/extract-hour-and-weekday-from-custom-date-time-field/237286)._
