# How to create a custom time range for Last Month in kibana

**URL:** <https://discuss.elastic.co/t/how-to-create-a-custom-time-range-for-last-month-in-kibana/166740>\
**Category:** Kibana\
**Created:** [February 1, 2019, 1:42pm UTC](https://discuss.elastic.co/t/how-to-create-a-custom-time-range-for-last-month-in-kibana/166740 "2019-02-01T13:42:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shripal](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@Shripal](https://discuss.elastic.co/u/Shripal)\
**Post date:** [February 1, 2019, 1:42pm UTC](https://discuss.elastic.co/t/how-to-create-a-custom-time-range-for-last-month-in-kibana/166740/1 "2019-02-01T13:42:02Z")

</div>

Hi all,  
I am trying to make a custom time range to be added in the 'Quick' section of time range in kibana.  
I want to make a quick time range field called 'Last Month'.

This is the expression that I added in the advance setting\>\> Time picker quick ranges.

{

"from": "now/M-1M",

"to": "now/M-1M",

"display": "Last Month (Custom)",

"section": 1

},

This shows the date ranges from:  
1st January 00.00 to 28th Jan 23.59.  
How can I show the date ranges from 1st jan 00.00 to 31st Jan 23.59 ( or from the first date of the last month to the last date of the last month.) ?

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [February 22, 2019, 10:25am UTC](https://discuss.elastic.co/t/how-to-create-a-custom-time-range-for-last-month-in-kibana/166740/2 "2019-02-22T10:25:22Z")

</div>

Hello,  
Can you try with the following one?  
{

"from": "now/M-1",

"to": "now/M-1",

"display": "Last Month (Custom)",

"section": 1

}

---

<div class="post-metadata">

**Author:** ![Shripal](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@Shripal](https://discuss.elastic.co/u/Shripal)\
**Post date:** [March 1, 2019, 4:46pm UTC](https://discuss.elastic.co/t/how-to-create-a-custom-time-range-for-last-month-in-kibana/166740/3 "2019-03-01T16:46:56Z")

</div>

Hello Marius,

Thanks for your response!

I tried the solution given by you. It didn't work. But after tweaking it a bit, I finally arrived at the solution, and it did work. It is:

{

"from": "now/M-1M",

"to": "now-1M/M",

"display": "Last Month (Custom)",

"section": 1

}

---

<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:** [March 29, 2019, 4:46pm UTC](https://discuss.elastic.co/t/how-to-create-a-custom-time-range-for-last-month-in-kibana/166740/4 "2019-03-29T16:46:59Z")

</div>

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