# Can someone explain how these time functions work?

**URL:** <https://discuss.elastic.co/t/can-someone-explain-how-these-time-functions-work/222168>\
**Category:** Logstash\
**Created:** [March 4, 2020, 10:13pm UTC](https://discuss.elastic.co/t/can-someone-explain-how-these-time-functions-work/222168 "2020-03-04T22:13:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_Thunder](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jim_thunder/32/45439_2.png) [@Jim\_Thunder](https://discuss.elastic.co/u/Jim_Thunder)\
**Post date:** [March 4, 2020, 10:13pm UTC](https://discuss.elastic.co/t/can-someone-explain-how-these-time-functions-work/222168/1 "2020-03-04T22:13:13Z")

</div>

This is confusing me and I just want to understand how this all works:

I have two new fields called @SMF\_TIMESTAMP and @split\_time.

SMF\_TIMESTAMP I convert to my timezone per the code below. And split\_time I set to UTC (even though it's already in UTC, so it's probably redundant code).

Then I pull the hour out of each timestamp. When I do that, I get the current timezone hour from split\_time (even though it's in UTC) and I get 6 hours AHEAD of the SMF\_TIMESTAMP field (even though it's set to -0600).

So my question is why do I get my current timezone's hour from a timestamp that's six hours ahead?

And why do I get an hour that's 6 hours ahead when pulled from a UTC timestamp?

I have what I need already but I just want to understand what's at work behind the scenes... here are some photos:

![image](https://us1.discourse-cdn.com/elastic/original/3X/8/4/845cc1b0e24911b8ba464fe3a845aa8c33b9b3e2.png)

Results from the code above:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/d/ad99cf7c88025f9070a1930e093f6a14fc498d2c.png)

---

<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 1, 2020, 10:13pm UTC](https://discuss.elastic.co/t/can-someone-explain-how-these-time-functions-work/222168/2 "2020-04-01T22:13:14Z")

</div>

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