# How to calculate old date from today by subtracting given years, months, days in logstash?

**URL:** https://discuss.elastic.co/t/how-to-calculate-old-date-from-today-by-subtracting-given-years-months-days-in-logstash/283349
**Category:** Logstash
**Created:** [September 4, 2021, 4:24pm UTC](https://discuss.elastic.co/t/how-to-calculate-old-date-from-today-by-subtracting-given-years-months-days-in-logstash/283349 "2021-09-04T16:24:00Z")
**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: [September 4, 2021, 4:35pm UTC](https://discuss.elastic.co/t/how-to-calculate-old-date-from-today-by-subtracting-given-years-months-days-in-logstash/283349/2 "2021-09-04T16:35:45Z")

</div>

I answered how to do that using DateTime methods like prev\_month on SO [here](https://stackoverflow.com/a/69057160/11792977).

---

_[View the full topic](https://discuss.elastic.co/t/how-to-calculate-old-date-from-today-by-subtracting-given-years-months-days-in-logstash/283349)._
