# How to convert yyyyMMddHHmmssSSSZ string into timestamp

**URL:** <https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596>\
**Category:** Logstash\
**Created:** [February 15, 2019, 1:28pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596 "2019-02-15T13:28:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![priya08](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@priya08](https://discuss.elastic.co/u/priya08)\
**Post date:** [February 15, 2019, 1:28pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/1 "2019-02-15T13:28:24Z")

</div>

Hi ,

I want to convert date string yyyyMMddHHmmssSSSZ to timezone , I have tried with  
date {  
match =\> ["datetime", "YYYYMMddHHmmssSSS"]  
target =\> "datetime"  
}  
but i am getting \_dateparsefailure in tags.

How to convert this?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 15, 2019, 1:43pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/2 "2019-02-15T13:43:32Z")

</div>

Hard to say without an example.  
Anyway I moved your question to #logstash

---

<div class="post-metadata">

**Author:** ![priya08](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@priya08](https://discuss.elastic.co/u/priya08)\
**Post date:** [February 18, 2019, 6:19am UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/3 "2019-02-18T06:19:40Z")

</div>

Hi ,

Sample log statement is : [INFO] SYSLOG-\>|datetime:20190218142929801+0530|hostname:ABCD

---

<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:** [February 18, 2019, 1:06pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/4 "2019-02-18T13:06:36Z")

</div>

What is in the field datetime?

---

<div class="post-metadata">

**Author:** ![priya08](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@priya08](https://discuss.elastic.co/u/priya08)\
**Post date:** [February 20, 2019, 10:43am UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/5 "2019-02-20T10:43:18Z")

</div>

datetime is string field

---

<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:** [February 20, 2019, 1:05pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/6 "2019-02-20T13:05:06Z")

</div>

What exactly are the contents of the string field?

---

<div class="post-metadata">

**Author:** ![priya08](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@priya08](https://discuss.elastic.co/u/priya08)\
**Post date:** [February 20, 2019, 1:07pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/7 "2019-02-20T13:07:01Z")

</div>

Datetime field having datetime in this format yyyyMMddHHmmssSSSZ

---

<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:** [February 20, 2019, 1:13pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/8 "2019-02-20T13:13:27Z")

</div>

If it has that format then

```
date { match => ["datetime", "yyyyMMddHHmmssSSSZ"] }

```

will parse it.

---

<div class="post-metadata">

**Author:** ![priya08](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@priya08](https://discuss.elastic.co/u/priya08)\
**Post date:** [February 20, 2019, 1:14pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/9 "2019-02-20T13:14:02Z")

</div>

getting \_dateparsefailure tag

---

<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:** [February 20, 2019, 1:24pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/10 "2019-02-20T13:24:19Z")

</div>

Then it does not have the format that you claim it has. Given that you have not shown us the data there is nothing else I can do to help.

---

<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 20, 2019, 1:24pm UTC](https://discuss.elastic.co/t/how-to-convert-yyyymmddhhmmsssssz-string-into-timestamp/168596/11 "2019-03-20T13:24:23Z")

</div>

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