# Only Date needed

**URL:** <https://discuss.elastic.co/t/only-date-needed/195531>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [August 16, 2019, 4:17pm UTC](https://discuss.elastic.co/t/only-date-needed/195531 "2019-08-16T16:17:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganga](https://avatars.discourse-cdn.com/v4/letter/g/ebca7d/32.png) [@ganga](https://discuss.elastic.co/u/ganga)\
**Post date:** [August 16, 2019, 4:17pm UTC](https://discuss.elastic.co/t/only-date-needed/195531/1 "2019-08-16T16:17:54Z")

</div>

Hi,

I am trying to write a painless script code where I got a date in the format like: Fri Aug 16 11:20:43 EDT 2019, but all I need is only like this ( 8/16/19 ).

I am using "new Date() " in my script which resides in html, something which looks like below  
op+="**Yesterday's Service usage date:" + new Date()+ "**";

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [August 16, 2019, 4:23pm UTC](https://discuss.elastic.co/t/only-date-needed/195531/2 "2019-08-16T16:23:15Z")

</div>

Hello,

Did you give field formatters a try?  
[https://www.elastic.co/guide/en/kibana/current/field-formatters-date.html](https://www.elastic.co/guide/en/kibana/current/field-formatters-date.html)

Hopefully that should help.

Thanks,  
Bhavya

 ![32%20PM](https://us1.discourse-cdn.com/elastic/original/3X/a/c/ac1ca749043f7e6bf9ebc3f032338c2d5dda00ee.png)

---

<div class="post-metadata">

**Author:** ![ganga](https://avatars.discourse-cdn.com/v4/letter/g/ebca7d/32.png) [@ganga](https://discuss.elastic.co/u/ganga)\
**Post date:** [August 18, 2019, 5:19pm UTC](https://discuss.elastic.co/t/only-date-needed/195531/3 "2019-08-18T17:19:10Z")

</div>

what I was trying to do is execute a "Post" painless script with, all I need is yesterday's date

How can I get that?

I tried which you said, its asking to fill " script" field and still If I passed something in that field, still I am not able to find the solution.

It would be grateful, if you could elaborate the solution.

thanks,  
ganga reddy

---

<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:** [September 15, 2019, 5:19pm UTC](https://discuss.elastic.co/t/only-date-needed/195531/4 "2019-09-15T17:19:14Z")

</div>

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