# Date filter not working for AM/PM

**URL:** https://discuss.elastic.co/t/date-filter-not-working-for-am-pm/89253
**Category:** Logstash
**Created:** [June 13, 2017, 6:20pm UTC](https://discuss.elastic.co/t/date-filter-not-working-for-am-pm/89253 "2017-06-13T18:20:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wlin](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@wlin](https://discuss.elastic.co/u/wlin)
#### Post date: [June 13, 2017, 6:20pm UTC](https://discuss.elastic.co/t/date-filter-not-working-for-am-pm/89253/1 "2017-06-13T18:20:19Z")

</div>

I have some log file for example this:  
...  
{"timestamp":"Jun 12, 2017 6:19:31 PM","ip":"0:0:0:0:0:0:0:1"}  
...  
As I want to use the timestamp in the log file, I use a data filter to match it

input {  
beats {  
port =\> "5044"  
}  
}  
filter {  
json {  
source =\> "message"  
}  
date {  
match =\> ["timestamp","MMM dd, yyyy HH:mm:ss a"]  
target =\> "@timestamp"  
}  
}  
output {  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> 'api\_log-%{+YYYY.MM.dd}'  
}  
}

But when I look into Kibana, I find that the time stamp it creates is June 12th 2017, 06:19:31.000  
What I expect is June 12th 2017, 18:19:31.000

I do a little experiment here and I change the original "PM" to "AM". The result is still the same, which means the date filter is not working in the correct way. Can somebody tells me how to fix this?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [June 13, 2017, 6:23pm UTC](https://discuss.elastic.co/t/date-filter-not-working-for-am-pm/89253/2 "2017-06-13T18:23:54Z")

</div>

Don't use HH for the hours, use hh instead. See [http://www.joda.org/joda-time/key\_format.html](http://www.joda.org/joda-time/key_format.html).

---

<div class="post-metadata">

### Author: ![wlin](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@wlin](https://discuss.elastic.co/u/wlin)
#### Post date: [June 13, 2017, 6:30pm UTC](https://discuss.elastic.co/t/date-filter-not-working-for-am-pm/89253/3 "2017-06-13T18:30:11Z")

</div>

Thank you so much

---

<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: [July 11, 2017, 6:30pm UTC](https://discuss.elastic.co/t/date-filter-not-working-for-am-pm/89253/4 "2017-07-11T18:30:15Z")

</div>

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