# Importing MySql rows with existing timestamp when not stored as UTC

**URL:** <https://discuss.elastic.co/t/importing-mysql-rows-with-existing-timestamp-when-not-stored-as-utc/160615>\
**Category:** Logstash\
**Created:** [December 12, 2018, 8:09pm UTC](https://discuss.elastic.co/t/importing-mysql-rows-with-existing-timestamp-when-not-stored-as-utc/160615 "2018-12-12T20:09:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wgehalo](https://avatars.discourse-cdn.com/v4/letter/w/51bf81/32.png) [@wgehalo](https://discuss.elastic.co/u/wgehalo)\
**Post date:** [December 12, 2018, 8:09pm UTC](https://discuss.elastic.co/t/importing-mysql-rows-with-existing-timestamp-when-not-stored-as-utc/160615/1 "2018-12-12T20:09:07Z")

</div>

I've been searching around and can't seem to find an answer to this.

I have a MySql database which I am importing via logstash, which has an existing timestamp field called "receivetime". This is the field I want to use as the timestamp. It contains no timezone data, or if it does it's incorrectly set to UTC in the MySql Database.

When I import these to Elasticsearch using Logstash it works, and when I create an index pattern in Kibana I am able to select the field "receivetime" as the field for the time filter. The problem is it's reading the date as UTC, and adjusting it to EST which subracts 5 hours from it. It's already in an EST format, so this makes all entries 5 hours behind the actual time.

Basically, I need some way to add 5 hours to this field when importing so it stores it in UTC instead of EST.

I'm thinking about adjusting my SQL query to do this, but figured since logstash is designed to transform data there could be a way to do this.

Any suggestions would be greatly appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![wgehalo](https://avatars.discourse-cdn.com/v4/letter/w/51bf81/32.png) [@wgehalo](https://discuss.elastic.co/u/wgehalo)\
**Post date:** [December 13, 2018, 3:07pm UTC](https://discuss.elastic.co/t/importing-mysql-rows-with-existing-timestamp-when-not-stored-as-utc/160615/2 "2018-12-13T15:07:23Z")

</div>

Well I figured out a workaround by changing the date as a select it in the sql statement:

```
SELECT DATE_ADD(receivetime, INTERVAL 5 HOUR) as receivetime

```

Really the Sql data should have been stored as UTC in the first place but that's out of my control so this will work as long as they consistently continue to insert records as EST.

---

<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, 2019, 3:07pm UTC](https://discuss.elastic.co/t/importing-mysql-rows-with-existing-timestamp-when-not-stored-as-utc/160615/3 "2019-01-10T15:07:26Z")

</div>

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