# Problem in Parsing date

**URL:** <https://discuss.elastic.co/t/problem-in-parsing-date/124296>\
**Category:** Logstash\
**Created:** [March 16, 2018, 1:03pm UTC](https://discuss.elastic.co/t/problem-in-parsing-date/124296 "2018-03-16T13:03:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Debashis\_Adak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/debashis_adak/32/46087_2.png) [@Debashis\_Adak](https://discuss.elastic.co/u/Debashis_Adak)\
**Post date:** [March 16, 2018, 1:03pm UTC](https://discuss.elastic.co/t/problem-in-parsing-date/124296/1 "2018-03-16T13:03:52Z")

</div>

Hi,

I am facing an unique problem. I have a server in USA which is generating with timestamp like "\<Mar 16, 2018 9:11:01 AM UTC\>"

Can anyone tell me how to handle UTC part? The date is already in UTC and I don't want to change the date but logstash is changing it as the server is in USA.

Right Now I am doing like :

In grok : \<%{DATA:Timestamp} UTC\>

So here Timestamp = Mar 16, 2018 9:11:01 AM

Then:

date {  
match =\> [ "Timestamp",  
"MMM dd, YYYY KK:mm:ss aa",  
"MMM d, YYYY KK:mm:ss aa" ]  
target =\> "@timestamp"  
timezone =\> "UTC"  
}

Now sure how to handle "UTC".

Thanks & Regards,  
Debashis Adak

---

<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:** [March 16, 2018, 1:31pm UTC](https://discuss.elastic.co/t/problem-in-parsing-date/124296/2 "2018-03-16T13:31:25Z")

</div>

> [@Debashis\_Adak](#):
>
> "MMM dd, YYYY KK:mm:ss aa",
> 
> "MMM d, YYYY KK:mm:ss aa"

You do not need to specify the second one, it is implied by the first.

For the message "Mar 6, 2018 9:11:01 PM UTC"

```
grok { match => { "message" => "%{DATA:Timestamp} UTC" } }
  date { match => ["Timestamp", "MMM dd, YYYY KK:mm:ss aa"] target => "@timestamp" timezone => "UTC" }
```

will produce

```
"Timestamp" => "Mar 6, 2018 9:11:01 PM",
    "@timestamp" => 2018-03-06T21:11:01.000Z
```

What is the problem with that?

---

<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:** [April 13, 2018, 1:31pm UTC](https://discuss.elastic.co/t/problem-in-parsing-date/124296/3 "2018-04-13T13:31:50Z")

</div>

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