> ## Documentation Index
> Fetch the complete documentation index at: https://bun-1dd33a4e-farm-15490b5d-test-done-error-hook.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. To do set, set the value of the `TZ` environment variable to a [valid timezone identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

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

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

```ts process.ts icon="https://mintcdn.com/bun-1dd33a4e-farm-15490b5d-test-done-error-hook/dtyJFOORXktpqgAt/icons/typescript.svg?fit=max&auto=format&n=dtyJFOORXktpqgAt&q=85&s=d88c07e26cef48a230df2faee376b314" theme={null}
process.env.TZ = "America/New_York";
```

***

Alternatively, this can be set from the command line when running a Bun command.

```sh terminal icon="terminal" theme={null}
TZ=America/New_York bun run dev
```

***

Once `TZ` is set, any `Date` instances will have that time zone. By default all dates use your system's configured time zone.

```ts process.ts icon="https://mintcdn.com/bun-1dd33a4e-farm-15490b5d-test-done-error-hook/dtyJFOORXktpqgAt/icons/typescript.svg?fit=max&auto=format&n=dtyJFOORXktpqgAt&q=85&s=d88c07e26cef48a230df2faee376b314" theme={null}
new Date().getHours(); // => 18

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

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