# Changing Time Zone for Kafka

**URL:** <https://forum.confluent.io/t/changing-time-zone-for-kafka/10170>\
**Category:** Ops\
**Created:** [13 February 2024 16:07 UTC](https://forum.confluent.io/t/changing-time-zone-for-kafka/10170 "2024-02-13T16:07:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![haarvester](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/haarvester/32/1436_2.png) [@haarvester](https://forum.confluent.io/u/haarvester)\
**Post date:** [13 February 2024 16:07 UTC](https://forum.confluent.io/t/changing-time-zone-for-kafka/10170/1 "2024-02-13T16:07:34Z")

</div>

Hi, All.  
Who knows how Kafka will behave when changing time zones? We are soon switching from UTC +6 to UTC +5. Will simply changing the settings in NTP or Chrony resolve this issue? Perhaps someone has practical experience dealing with this?

---

<div class="post-metadata">

**Author:** ![dtroiano](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/dtroiano/32/1961_2.png) [@dtroiano](https://forum.confluent.io/u/dtroiano)\
**Post date:** [14 February 2024 20:43 UTC](https://forum.confluent.io/t/changing-time-zone-for-kafka/10170/2 "2024-02-14T20:43:41Z")

</div>

I can’t think of any issues that you’ll need to worry about since Kafka generally deals in Unix epoch timestamps. As long as the system time is correct, then timestamps in headers and operations that rely on time like log cleaning will “just work”.

What specifically is switching time zones? Brokers? Clients? And what mechanism? Literally shut down servers in one time zone and boot up in another? Any time-based aggregations or other application-level issues that you need to worry about? What format are the timestamps in logs and do you need to tweak any log4j config (unlikely)?

I’d recommend a little sanity check program in the new time zone to make sure it’s done properly. Copy this into `PrintTime.java` and run `javac PrintTime.java && java PrintTime` and make sure the output looks right (e.g., compare to [epochconverter.com](https://www.epochconverter.com/)):

```java
import java.time.Instant;

public class PrintTime {
    public static void main(final String[] args) {
        System.out.println("System.currentTimeMillis(): " + System.currentTimeMillis());
        System.out.println("Instant.now().toEpochMilli(): " + Instant.now().toEpochMilli());
    }
}

```

---

<div class="post-metadata">

**Author:** ![haarvester](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/haarvester/32/1436_2.png) [@haarvester](https://forum.confluent.io/u/haarvester)\
**Post date:** [20 February 2024 16:49 UTC](https://forum.confluent.io/t/changing-time-zone-for-kafka/10170/3 "2024-02-20T16:49:36Z")

</div>

Hi @dtroiano. Thank you for your response. This is not the usual annual time zone change, but an entire part of the country changing time from UTC +6 to +5. Brokers, clients all system will change time zone. Producers write to the topic in local time UTC +6. Timestamps in log in local format.
