> ## Documentation Index
> Fetch the complete documentation index at: https://bun-1dd33a4e-farm-47265618-file-slice-stream-hang.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Set a time zone in Bun

Bun supports programmatically setting a default time zone for the lifetime of the `bun` process. Set the `TZ` environment variable to a [valid time zone identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

<Note>
  When running a file with `bun`, the time zone defaults to your system's configured local time zone.

  When running tests with `bun test`, the time zone is set to `UTC` to make tests more deterministic.
</Note>

```ts process.ts icon="https://mintcdn.com/bun-1dd33a4e-farm-47265618-file-slice-stream-hang/ZiIlD0efumrA_ap0/icons/typescript.svg?fit=max&auto=format&n=ZiIlD0efumrA_ap0&q=85&s=d3ea8d53d37fb8d8e83641ee2f63f641" theme={"theme":{"light":"github-light","dark":"dracula"}}
process.env.TZ = "America/New_York";
```

***

You can also set `TZ` on the command line when running a Bun command.

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
TZ=America/New_York bun run dev
```

***

Once `TZ` is set, every `Date` instance uses that time zone.

```ts process.ts icon="https://mintcdn.com/bun-1dd33a4e-farm-47265618-file-slice-stream-hang/ZiIlD0efumrA_ap0/icons/typescript.svg?fit=max&auto=format&n=ZiIlD0efumrA_ap0&q=85&s=d3ea8d53d37fb8d8e83641ee2f63f641" theme={"theme":{"light":"github-light","dark":"dracula"}}
new Date().getHours(); // => 18

process.env.TZ = "America/New_York";

new Date().getHours(); // => 21
```
