# Dreded date with timezone :)

**URL:** <https://discuss.elastic.co/t/dreded-date-with-timezone/211718>\
**Category:** Logstash\
**Created:** [December 12, 2019, 8:19pm UTC](https://discuss.elastic.co/t/dreded-date-with-timezone/211718 "2019-12-12T20:19:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajsolanki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajsolanki/32/86859_2.png) [@rajsolanki](https://discuss.elastic.co/u/rajsolanki)\
**Post date:** [December 12, 2019, 8:19pm UTC](https://discuss.elastic.co/t/dreded-date-with-timezone/211718/1 "2019-12-12T20:19:21Z")

</div>

so i m trying to parse XML and ingest . Here is my XML

ReceivedTimestamp and DeliveredTimestamp are in CST (Chicago)

\<?xml version="1.0" encoding="UTF-8" standalone="no"?\> 2019-12-12T02:10:032019-12-12T02:20:03

Here is my logstash config.

```
input { stdin { } }
filter {
         xml {
           source => "message"
           store_xml => "false"
           xpath => [
                  "/TransactionDB/TDB_ReceivedTimestamp/text()","ReceivedTimestamp",
                  "/TransactionDB/TDB_DeliveredTimestamp/text()","DeliveredTimestamp"
                  ]
           } # end of xml

        mutate {
        replace => [
              "ReceivedTimestamp" , "%{[ReceivedTimestamp][0]}",
              "DeliveredTimestamp" , "%{[DeliveredTimestamp][0]}"
              ]
         }
          mutate {
        remove_field => ["message","host"]
    }

         date{
            #timezone => "Etc/GMT+6"
            match => ["ReceivedTimestamp","ISO8601"]
            timezone => "America/Chicago"
    }

        date{
            #timezone => "Etc/GMT+6"
            match => ["DeliveredTimestamp","ISO8601"]
            timezone => "America/Chicago"
    }

}
output {

         stdout { codec => rubydebug {}}
  }

```

Here is my output.

{  
"DeliveredTimestamp" =\> "2019-12-12T02:20:03",  
"@version" =\> "1",  
"@timestamp" =\> 2019-12-12T08:20:03.000Z,  
"ReceivedTimestamp" =\> "2019-12-12T02:10:03"  
}  
[2019-12-12T14:10:34,632][INFO][logstash.runner] Logstash shut down.

so the thing presentation layer (kibana) is converting ReceivedTimestamp and DeliveredTimestamp with -6 hours. so that shows up as of Dec 11, 2019 @ 20:10:03.000 and Dec 11, 2019 @ 20:20:03.000 which is wrong.

how do i convert those to UTC + 6 or CST or correct time stamp so it reflects right?

---

<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:** [December 12, 2019, 11:15pm UTC](https://discuss.elastic.co/t/dreded-date-with-timezone/211718/2 "2019-12-12T23:15:28Z")

</div>

The first date filter sets @timestamp to 2019-12-12T08:10:03.000Z, the second overwrites it with 2019-12-12T08:20:03.000Z. Perhsp you should use the target option to tell the date filter where to store the result.

---

<div class="post-metadata">

**Author:** ![rajsolanki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajsolanki/32/86859_2.png) [@rajsolanki](https://discuss.elastic.co/u/rajsolanki)\
**Post date:** [December 13, 2019, 1:57pm UTC](https://discuss.elastic.co/t/dreded-date-with-timezone/211718/3 "2019-12-13T13:57:44Z")

</div>

That was it 🙂 Thanks a lot for quick response and solution.

Raj

---

<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:** [January 10, 2020, 1:57pm UTC](https://discuss.elastic.co/t/dreded-date-with-timezone/211718/4 "2020-01-10T13:57:59Z")

</div>

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