# Jdbc sql\_last\_value for UTC+8

**URL:** <https://discuss.elastic.co/t/jdbc-sql-last-value-for-utc-8/75431>\
**Category:** Logstash\
**Created:** [February 17, 2017, 4:43am UTC](https://discuss.elastic.co/t/jdbc-sql-last-value-for-utc-8/75431 "2017-02-17T04:43:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 17, 2017, 4:43am UTC](https://discuss.elastic.co/t/jdbc-sql-last-value-for-utc-8/75431/1 "2017-02-17T04:43:18Z")

</div>

Hi  
I want to ask how to set the sql\_last\_value for different time zone? according my understanding, the sql\_last\_value is using UTC time. But my database column(last\_update\_date) is using UTC+8 time. I just want to know how to modify the code in below, so that, the sql\_last\_value is equal to UTC+8

```
select * from my_table where last_update_date > :sql_last_value
```

---

<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:** [February 17, 2017, 6:29am UTC](https://discuss.elastic.co/t/jdbc-sql-last-value-for-utc-8/75431/2 "2017-02-17T06:29:26Z")

</div>

That's more a question for people who know your dialect of SQL. You can't get Logstash to convert `sql_last_value` to local time but I'd expect any RDBMS to be able to convert `last_update_date` to UTC.

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 17, 2017, 8:08am UTC](https://discuss.elastic.co/t/jdbc-sql-last-value-for-utc-8/75431/3 "2017-02-17T08:08:22Z")

</div>

I changed my code to

```
select * from my_table where DATE_SUB(last_update_date, INTERVAL 8 HOUR) > :sql_last_value

```

and it works

---

<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 17, 2017, 8:08am UTC](https://discuss.elastic.co/t/jdbc-sql-last-value-for-utc-8/75431/4 "2017-03-17T08:08:49Z")

</div>

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